#!/bin/python3 import sys def derivative(numbers): output = [] for x in range(len(numbers) - 1): output.append(numbers[x+1] - numbers[x]) return output output = 0 for line in sys.stdin: line = line.strip() numbers = [int(x) for x in line.split()] derivatives = [numbers] while len([x for x in derivatives[-1] if x != 0]) > 0: derivatives.append(derivative(derivatives[-1])) prediction = 0 for d in derivatives: prediction += d[-1] output += prediction print(f">> {output}")