{-# LANGUAGE BangPatterns #-}

import           Control.Monad
import           Data.Char

main :: IO ()
main = do
    n <- readLn
    tas <- replicateM n (map read . words <$> getLine)
    print $ solve tas

solve :: [[Int]] -> Int
solve = go 1 . map sum
    where
        go :: Int -> [Int] -> Int
        go !n []     = n
        go !n (x:xs) = go (head $ filter (\i -> i `mod` x == 0) [n..]) xs
