# -*- coding: utf-8 -*-

def b():
    time = []
    time_sum = 0
    nokori_sum = 0
    nokori = []
    N = 5
    for i in range(N):
        s = int(input())
        time.append(s)
        time_sum = time_sum + s
    
    for i in range(N):
        nokori.append(get_nokori(time[i]))
        nokori.sort()
    
    for i in range(N-1):
        nokori_sum = nokori_sum + nokori[i]
    print nokori_sum + time_sum


def get_nokori(cost):
    if cost % 10 == 0:
        return 0
    else:
        n = cost/10
        nokori = 10*(n+1) - cost
        return nokori


def main():
    b()
	
if __name__ == '__main__':
    main()