import Control.Arrow
import Control.Monad.State.Strict
 
main :: IO()
main = getLine >> getContents >>= print.fst.(\(x:y:ys) -> execState (solve ys) (y- x, min x y)).map read.lines
 
solve :: [Int] ->  State (Int, Int) [Int]
solve []     = return []
solve (y:ys) = get >>= \(a, b) -> modify $! ((max (y - b)) *** (min y)) >> solve ys