#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d, e;
  int ad, bd, cd, dd, ed, min;
  int ans = 0;
  cin >> a >> b >> c >> d >> e;
  int diff[5];
  diff[0] = a % 10;
  diff[1] = b % 10;
  diff[2] = c % 10;
  diff[3] = d % 10;
  diff[4] = e % 10;
  sort(diff, diff + 5);
  for (int i = 0; i < 5; i++) {
    if (diff[i] >= 1) {
      min = diff[i];
      break;
    }
  }
  if ((a == b) && (b == c) && (c == d) && (d == e))
    ans = (4 * (a + (10 - (a % 10)))) + a;
  if ((a % 10) != 0) a += (10 - (a % 10));
  if ((b % 10) != 0) b += (10 - (b % 10));
  if ((c % 10) != 0) c += (10 - (c % 10));
  if ((d % 10) != 0) d += (10 - (d % 10));
  if ((e % 10) != 0) e += (10 - (e % 10));
  if ((a == b) && (b == c) && (c == d) && (d == e))
    cout << ans << endl;
  else
    cout << (a + b + c + d + e) - (10 - min) << endl;
  return 0;
}
