using System;
using System.Linq;
using static System.Console;
 
public class B{
  static void Main(string[] args)
  {
    var s = Array.ConvertAll(new string[] { ReadLine(), ReadLine(), ReadLine(), ReadLine(), ReadLine() }, int.Parse);
    var sum = s.Aggregate(0, (n, elem) => elem % 10 == 0 ? n + elem: n + elem - elem%10 + 10);
    var min = s.Where(x => x % 10 != 0);
    var frac = min.Any() ? min.Min(x => x % 10) : 0;
    WriteLine(sum - 10 + frac);
  }
}