Problem 1 in Python, Java and C.