import sys l=map(int,sys.stdin.read().split()) t=10 print max(max(sum(l[x*t:x*t+t]),sum(l[x:x+91:t]))for x in range(t))