# input
listB = []
while True:
    try:
        listB.append(int(raw_input()))
    except:
        break;

A = listB[0]
B = listB[1]
C = listB[2]
D = listB[3]
E = listB[4]

totalCookingTime = A+B+C+D+E

A_lossTime = 10 - (A % 10 if A % 10 != 0 else 10)
B_lossTime = 10 - (B % 10 if B % 10 != 0 else 10)
C_lossTime = 10 - (C % 10 if C % 10 != 0 else 10)
D_lossTime = 10 - (D % 10 if D % 10 != 0 else 10)
E_lossTime = 10 - (E % 10 if E % 10 != 0 else 10)

maxLossTime = max(A_lossTime,B_lossTime,C_lossTime,D_lossTime,E_lossTime)

print(totalCookingTime + A_lossTime + B_lossTime + C_lossTime + D_lossTime +
      E_lossTime - maxLossTime)
