A = gets.to_f
B = gets.to_f
C = gets.to_f
D = gets.to_f
E = gets.to_f

nokori = []
nokori.push(10 - A%10) unless A%10 == 0
nokori.push(10 - B%10) unless B%10 == 0
nokori.push(10 - C%10) unless C%10 == 0
nokori.push(10 - D%10) unless D%10 == 0
nokori.push(10 - E%10) unless E%10 == 0

p ((A/10).ceil*10 + (B/10).ceil*10 + (C/10).ceil*10 + (D/10).ceil*10 + (E/10).ceil*10 - nokori.max).to_i