#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0, a = 9;
  bool flag;
  for (int i = 0; i < 5; i++) {
    int n;
    cin >> n;
    if (n % 10 == 0) {
      s += n;
    } else {
      s += n / 10 * 10 + 10;
      if (a % 10 > n % 10) a = n;
      flag = 1;
    }
  }
  if (flag)
    s = s - a / 10 * 10 - 10 + a;
  else
    s = s;
  cout << s << endl;
  return 0;
}
