#!/usr/bin/python3
# -*- coding:utf-8 -*-

from math import ceil

def main():
  s = 0
  xs = []
  for x in [int(input()) for _ in range(5)]:
    if x % 10 == 0:
      s += x
    else:
      xs.append(x)
  if len(xs) == 1:
    print(s + sum(xs))
  else:
    xs = sorted(xs, key=lambda x: x%10, reverse=True)
    print(s + sum(map(lambda x: ceil(x/10)*10, xs[:-1])) + xs[-1])

if __name__=='__main__':
  main()

