import math
a=int(input());b=int(input());c=int(input());d=int(input());e=int(input())

N=math.ceil(a/10)*10+math.ceil(b/10)*10+math.ceil(c/10)*10+math.ceil(d/10)*10+math.ceil(e/10)*10
X=[a%10,b%10,c%10,d%10,e%10]
if a==b==c==d==e:
  print(N-min(X))
else:
  print(N-(10-min(X)))