import math
import sys
import numpy

a = list(mat(int,input().split()))
b = []
for i in range(5):
    b.append(a[i]%10)
mx = min(b)
ans = 0
for i in range(5):
    if mx == a[i]:
        continue
    else :
        ans += (a[i]+10-(a[i]%10))
ans += mx
print(ans)