#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ra = a % 10;
  int rb = b % 10;
  int rc = c % 10;
  int rd = d % 10;
  int re = e % 10;
  vector<int> r = {ra, rb, rc, rd, re};
  sort(r.begin(), r.end());
  int rm;
  int cntz = 0;
  for (int i : r) {
    if (i = 0) {
      cntz++;
    } else {
      rm = i;
      break;
    }
  }
  int res = a + b + c + d + e;
  res = res + 10 * (5 - cntz) - ra - rb - rc - rd - re;
  res = res - 10 + rm;
  cout << rm << endl;
}
