# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 21:54:27 2019

@author: yuta
"""

ABCDE = [int(input()) for i in range(5)]

def main(x):
    rest = list(map(lambda y: 10 - y%10,x))
    print("before:",rest)
    for i in range(5):
        if rest[i] == 10:
            rest[i] = 0
    print("after:",rest)
    rest_sort = sorted(rest)
    t = sum(x) + sum(rest_sort[0:4])
    print(t)

main(ABCDE)