def f(x,y,z,t={}):a=x,y,z;v=t[a]=t.get(a)or x>y and f(f(x-5,y,z),f(y-5,z,x),f(z-5,x,y))or z;return v while 1:print f(*map(int,raw_input().split()))