#include <bits/stdc++.h>
using namespace std;
int main(int, char**) {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int result = 0;
  result += ceil((double)a / 10.0);
  result += ceil((double)b / 10.0);
  result += ceil((double)c / 10.0);
  result += ceil((double)d / 10.0);
  result += ceil((double)e / 10.0);
  result *= 10;
  int delta = 0;
  if (a % 10 != 0 && (delta > a % 10 || delta == 0)) delta = a % 10;
  if (b % 10 != 0 && (delta > b % 10 || delta == 0)) delta = b % 10;
  if (c % 10 != 0 && (delta > c % 10 || delta == 0)) delta = c % 10;
  if (d % 10 != 0 && (delta > d % 10 || delta == 0)) delta = d % 10;
  if (e % 10 != 0 && (delta > e % 10 || delta == 0)) delta = e % 10;
  result -= 10 - delta;
  cout << result << endl;
  return 0;
}
