a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = a//10*10 + b//10*10 + c//10*10 + d//10*10 + e//10*10 + 50

for i in range(1, 10):
    for j in [a, b, c, d, e]:
        if str(j)[-1] == str(i):
            ans += i - 10
            print(ans)
            exit()
print(ans)