a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

res_ = min([x%10 if x%10!=0 else 10 for x in [a,b,c,d,e]])
if res_ == 10:
  res_ = 0
sum_ = sum([10*(1+x//10) if (x%10!=0) else x for x in [a,b,c,d,e]])

print(sum_ + res_ - 10)