Problem 14, Python