a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a%10
B = b%10
C = c%10
D = d%10
E = e%10
list =[a,b,c,d,e]
ans = 0
for i in range(5):
  if l[i] % 10 != 0:
    mini = min(9,l[i])
print(a+b+c+d+e+A+B+C+D+E-mini)