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
M = min(A+1,B+1,C+1,D+1,E+1)
print(a+b+c+d+e+A+B+C+D+E-(M-1))