A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

inter_A = (A//10)*10 + 10
inter_B = (B//10)*10 + 10
inter_C = (C//10)*10 + 10
inter_D = (D//10)*10 + 10
inter_E = (E//10)*10 + 10

first_A = A + inter_B + inter_C + inter_D + inter_E
first_B = inter_A + B + inter_C + inter_D + inter_E
first_C = inter_A + inter_B + C + inter_D + inter_E
first_D = inter_A + inter_B + inter_C + D + inter_E
first_E = inter_A + inter_B + inter_C + inter_D + E
print(min[first_A, first_B, first_C, first_D, first_E])