a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = []
l = l + [a % 10]
l = l + [b % 10]
l = l + [c % 10]
l = l + [d % 10]
l = l + [e % 10]
m = min(l)
ma = 10 - m
ls =[]
ls = ls + [-(-a // 10) * 10]
ls = ls + [-(-b // 10) * 10]
ls = ls + [-(-c // 10) * 10]
ls = ls + [-(-d // 10) * 10]
ls = ls + [-(-e // 10) * 10]
s = sum(ls)
print(s -ma)