a = [int(input()) for i in range(5)]
b = [0]*5
c = 0
d = 0
def waru(k):
    global c
    if k < 4:
        b[k] = a[k]%10
        c += int(a[k]/10)
        waru(k + 1)
    else:
        b[k] = a[k]%10
        c += int(a[k]/10)
waru(0)
try:
    while True:
        b.remove(0)
except ValueError:
    d = c*10 + (len(b)-1)*10 + min(b)
    print(d)