A = $stdin.readline.to_i
B = $stdin.readline.to_i
C = $stdin.readline.to_i
D = $stdin.readline.to_i
E = $stdin.readline.to_i

minA = [(A % 10), (B % 10), (C % 10), (D % 10), (E % 10)]
minA.each_index {|idx| minA[idx] = 10 if minA[idx]  == 0 }

print (((A+9) / 10) * 10) + (((B+9) / 10) * 10) + (((C+9) / 10) * 10) + (((D+9) / 10) * 10) + (((E+9) / 10) * 10) - 10 + minA.min
