# -*- coding: utf-8 -*-
import numpy as np
T = np.zeros(5, dtype=int)
T[0] = int(input())
T[1] = int(input())
T[2] = int(input())
T[3] = int(input())
T[4] = int(input())
res = np.argsort(T%10)
for i in range(5):
  if(T[res[i]]%10 > 0):
    selected_index = res[i]
    break
tim = (T//10 + (T%10 != 0))*10
tim[selected_index] = T[selected_index]
print(sum(tim))
