program c20829

implicit none
integer(16) :: a, b, c, d, e, n, a1, b1, c1, d1, e1, a2, b2, c2, d2, e2, z

n = 0

read *, a
read *, b
read *, c
read *, d
read *, e

a1 = mod(a, 10)
b1 = mod(b, 10)
c1 = mod(c, 10)
d1 = mod(d, 10)
e1 = mod(e, 10)

!print *, a1, b1, c1, d1, e1

!stop

z = 10

if(z > a1 .and. a1 .ne. 0) then
 z = a1
end if

if(z > b1 .and. b1 .ne. 0) then
 z = b1
end if

if(z > c1 .and. c1 .ne. 0) then
 z = c1
end if

if(z > d1 .and. d1 .ne. 0) then
 z = d1
end if

if(z > e1 .and. e1 .ne. 0) then
 z = e1
end if

!print *, z

n = n + ceiling(real(a)/10) * 10
n = n + ceiling(real(b)/10) * 10
n = n + ceiling(real(c)/10) * 10
n = n + ceiling(real(d)/10) * 10
n = n + ceiling(real(e)/10) * 10
n = n - 10 + z

print *, n

end program c20829