• + 0 comments

    Haskell:

    main :: IO ()
    main = f <$> readN <*> readN >>= print
    
    f :: Integer -> Integer -> Integer
    f = ((`mod` k) .) . gcd
    
    k :: Integer
    k = 1000000007
    
    readN :: IO Integer
    readN = getLine >> product . map read . words <$> getLine