A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lst = [A,B,C,D,E]
rem = [ele%10 for ele in lst]
last = rem.index(min(rem))
ans = [lst[i] + (10-rem[i]) for i in range(5) if i != last]
print(sum(ans)+lst[last])