l = input().split()
max = 10
maxi = l[0]
for i in l:
    if 0<int(i)%10 < max:
        max = int(i)%10
        maxi = i
l.remove(maxi)
time =0
for i in l:
    if int(i)%10==0:
        time+=int(i)
    else:
        time += (int(int(i)/10)+1)*10
time = time + int(maxi)
print(time)
