
for a in range(1,100):
    for x in range(0,500):
        for y in range(0,500):
            if ((2*y-x<a) or (x+2*y>50) or (2*x+y<40))==0:
                break
        if ((2*y-x<a) or (x+2*y>50) or (2*x+y<40))==0:
            break
    else:
        print(a)
        break
