a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
a_1=(a//10)*10
b_1=(b//10)*10
c_1=(c//10)*10
d_1=(d//10)*10
e_1=(e//10)*10
a_2=a%10
b_2=b%10
c_2=c%10
d_2=d%10
e_2=e%10
if a_2==0 and b_2==0 and c_2==0 and d_2==0 and e_2==0:
  a_2+=0
elif a_2==0:
  a_2+=10
elif b_2==0:
  b_2+=10
elif c_2==0:
  c_2+=10
elif d_2==0:
  d_2+=10
elif e_2==0:
  e_2+=10
else:
  a_2+=0
l=[a_2, b_2, c_2, d_2, e_2]
l.sort()
print(a_1+b_1+c_1+d_1+e_1+l[0]+40)