# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

last = sorted(d.items(), key=lambda x: x[1])[0][0]

ll.remove(last)

ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)
