# -*- coding: utf-8 -*-
# 整数の入力
inputs = []
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
inputs.append(int(input()))
amari_list = []
time = 0
for input in inputs:
  amari = input % 10
  if amari == 0:
    time += input
  else:
    time += (input // 10) * 10
    amari_list.append(amari)
time += (len(amari_list) - 1)*10
time += min(amari_list)
# 出力
print(time)