c={} def f(x,y,z):r=c[x,y,z]=c.get((x,y,z))or f(f(x-5,y,z),f(y-5,z,x),f(z-5,x,y))if x>y else z;return r while 1:print f(*[int(e)for e in raw_input().split()])