
import math

a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
x = []
s = 0

if a % 10 != 0:
  x.append(a % 10)
  if min(x) == a % 10:
      s = math.ceil(a/10)*10

if b % 10 != 0:
  x.append(b % 10)
  if min(x) == b % 10:
      s = math.ceil(b/10)*10

if c % 10 != 0:
  x.append(c % 10)
  if min(x) == c % 10:
      s = math.ceil(c/10)*10


if d % 10 != 0:
  x.append(d % 10)
  if min(x) == d % 10:
      s = math.ceil(d/10)*10


if e % 10 != 0:
  x.append(e % 10)
  if min(x) == e % 10:
      s = math.ceil(e/10)*10

s = 0

if min(x) !=0:
  s = 10

print(math.ceil(a/10)*10 +  math.ceil(b/10)*10 +  math.ceil(c/10)*10 +  math.ceil(d/10)*10 +  math.ceil(e/10)*10 + min(x) -s )


