import math
A,B,C,D,E = [int(input()) for _ in range(5)]
A1 = math.ceil(A/10) * 10
B1 = math.ceil(B/10) * 10
C1 = math.ceil(C/10) * 10
D1 = math.ceil(D/10) * 10
E1 = math.ceil(E/10) * 10
A2 = A % 10
B2 = B % 10
C2 = C % 10
D2 = D % 10
E2 = E % 10
for i in range(1,11):
    if A2 == i or B2 == i or C2 == i or D2 == i or E2 == i:
        print(A1+B1+C1+D1+E1-(10-i))
        break