1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/python import sys total=0 while 1: try: line = sys.stdin.readline() if not line: break total += int(line) print total except: sys.exit(1)