# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 21:47:51 2019

@author: Tabe
"""

dish = list()

fst = list()

bsum = list()

flag = False
#すべての入力を得る
for i in range(5):
    dish.append(int(input()))

sdish = [str(n) for n in dish]

print(sdish)
#1の位を取得
for index, val in enumerate(sdish):
    fst.append(int(val[-1]))

#0を除く一番小さいもののインデックス番号を取得
for index, val in enumerate(fst):
    for i in  range(10):
        if i+1 == val:
            minIndex = index
            flag = True
            break
    if flag == True:
        break;
minData = dish[minIndex]


dish.pop(minIndex)

#一番小さいものを除いたデータの合計値を取得
for value in  dish:
    t = str(value)
    i = int(t[0])
    bsum.append((i + 1)* 10 ^ (value-1))

sumData = sum(bsum)

#合計
print(sumData + minData)






    
