a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
mm = [10 - i % 10 for i in nums]
mm = [x for x in mm if x != 10]
tmp = set(tmp)
tmp = list(tmp)
for i in range(5):
    if nums[i] % 10 == 0:
        ans += nums[i]
    else:
        ans += nums[i] + (10 - nums[i] % 10)
print(ans - max(mm))