def T(x,y,z,C={}):t=x,y,z;C[t]=C.get(t,(x<=y)*z)or T(T(x-5,y,z),T(y-5,z,x),T(z-5,x,y));return C[t] while 1:print T(*map(int,raw_input().split()))