times=[]
for i in range(5):
  times.append(int(input()))
rem=9
sum=0
count=False
for i in range(5):
  if times[i]%10==0:
    sum+= times[i]
  else:
    sum+= (times[i]//10)*10+10
    rem=min(rem,times[i]%10)
    count=True
if count:
  rem-=10
print(sum+rem)