A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

dic = {"A":A,"B":B,"C":C,"D":D,"E":E}

arr1 = []
arr2 = []
res = 0

for k,v in dic.items():
    if v % 10 != 0:
        arr1.append((int(v / 10) + 1 ) * 10 - v)
    res += v

fraction = sum(arr1)     
for i in arr1:
    arr2.append(fraction - i)

print(res + min(arr2))