a = [int(input()) for i in range(5)]

a_one = [i % 10 for i in a if i % 10 != 0]
a_aaa = [i for i in a if i % 10 != 0]
a_aa = [i // 10 * 10 + 10 for i in a if i % 10 != 0]
a_two = [i for i in a if i % 10 == 0]
a_last = a_one.index(min(a_one))

ans = 0

for i in range(len(a_aa)):
    if i == a_last:
        continue
    else:
        ans += a_aa[i]

for i in a_two:
    ans += i

ans += a_aaa[a_last]
print(ans)