import sys
import math

def main():
    input = sys.stdin.readline
    
    L = [int(input()) for i in range(5)]
    
    #最後の注文を決める
    last_orders = [10 - (i % 10) for i in L if i % 10 != 0]
    last_order = max(last_orders)
    
    #一の位を切り上げ
    all_order = sum([math.ceil(i / 10) * 10 for i in L])
    
    print(all_order - last_order)
    
if __name__ == '__main__':
    main()