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

order= []
for i in range(5):
    order.append(input())
    
min1 = 9
arg_min1 = 0
for i in range(5):
    #print(order[i][len(order[i])-1],len(order[i]),order[i])
    if int(order[i][-1]) < min1 and int(order[i][-1]) > 0:
        #print(int(order[i][-1]))
        min1 = int(order[i][-1])
        arg_min1= i

print(arg_min1)
for i in range(5):
    order[i]= int(order[i])
        
order_min_sum = 0
for i in range(5):
    if arg_min1 == i:
        order_min_sum += int(order[i])
    else:
        while True:
            if int(order[i]) %10 == 0:
                break
            else:
                #print("are:{}".format(order[i]))
                order[i] = order[i] +1
        order_min_sum += order[i]
    #print("sum,{}".format(order_min_sum))
print(order_min_sum)