g=0
s=0
x=0
with open('dinner1.in','r',encoding='utf-8') as f:
	lines=f.readlines()
s=lines[1]
print(lines)
c=int(s[0])+int(s[2])
for i in range(len(lines)-1):
  s=lines[i+1]
  for i in range(len(lines)+1):
      if i%2==0:
        c=int(s[i])
        g=g+c
        print(c)
        print(g)
d=lines[0]
if g<int(d[2]):
  print(int(d[2]))
else:
  print(g)
