# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 20:39:40 2019

@author: Yamazaki Kenichi
"""
import math

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

a = 10
if A%x != 0:
    a = min(a,A%x)
if B%x != 0:
    a = min(a,B%x)
if C%x != 0:
    a = min(a,C%x)
if D%x != 0:
    a = min(a,D%x)
if E%x != 0:
    a = min(a,E%x)
if 0 == max(A%x,B%x,C%x,D%x,E%x):
    a = 0
b = math.ceil(A/x) + math.ceil(B/x) + math.ceil(C/x) + math.ceil(D/x) + math.ceil(E/x)

print((b-1)*10 + a)