import math
a,b,c,d,e = map(int, open(0).read().split())
an = -(-a//10)*10
bn = -(-b//10)*10
cn = -(-c//10)*10
dn = -(-d//10)*10
en = -(-e//10)*10
total = math.ceil(an+bn+cn+dn+en)
tt=[]
ap = a%10
bp = b%10
cp = c%10
dp = d%10
ep = e%10
ff = [ap,bp,cp,dp,ep]
for i in ff:
  if i !=0:
    tt.append(i) 
    goal=total-10+min(tt)
  else:
    goal=total
print(goal)