k=[]

k.append(input())
k.append(input())
k.append(input())
k.append(input())
k.append(input())

m_num=9
m_index=0
for i in range(len(k)):
    if int(k[i][-1]) != 0:
        if int(k[i][-1]) < m_num:
            m_num = int(k[i][-1])
            m_index = i
            
print(m_num,m_index)
sum=0
for i in range(len(k)):
    if i==m_index:
        sum+=int(k[i])
    else:
        sum+=((int(k[i])-1)//10 + 1) * 10
    print(sum)