a = [int(i) for i in input().split()] 
sum = 0;
res = 0; 
temp = 0;
num = 0;
for i in range(5):
  if(a[i]%10==0):
    sum+=a[i]
  else:
    temp = (a[i]%10 +1)*10-a[i];
    if temp>res:
      sum = sum + res 
      res =temp
      sum+=a[i]
    else:
      sum = sum+a[i]+temp
print(sum)
  