if __name__ == '__main__':
    T = [int(input()) for _ in range(5)]
    
    del_max = 0
    idx_max = None
    for i in range(5):
        if T[i]%10 == 0:
            pass
        elif 10 - T[i]%10 > del_max:
            del_max = max(T[i]%10 - 5, 5 - T[i]%10)
            idx_max = i
    
    count = 0
    for i in range(5):
        if i != idx_max:
            time = (T[i]//10)*10
            if time < T[i]:
                time += 10
            count += time
    count += T[idx_max]
    
    print(count)