a = []
b = []
for i in range(5):
    n = int(input())
    b.append(n % 10)
    while n % 10 != 0:
        n = n + 1
    a.append(n)

if min(b) == 0:
    print(a[0] + a[1] + a[2] + a[3] + a[4])
else:
    print(a[0] + a[1] + a[2] + a[3] + a[4] - 10 + min(b))