import math
import numpy as np

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A, B, C, D, E]

list_1=[]
for i in range(len(list)):
    list_1.append(math.ceil(list[i]) * 10 - list[i]) # 待ち時間

max_iter = np.argmax(list_1)  # 最大インデックス
sum = list[max_iter]
del list[max_iter]
del list_1[max_iter]
sum = sum + np.sum(list) + np.sum(list_1)


