main :: IO () main = do -- Read an integer from standard input x <- readLn :: IO Int -- Define a lambda function to perform the calculation let calculate = \n -> n * (n + 1) `div` 2 -- Apply the function and print the result let result = calculate x print result