#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> s(5);
  for (auto& tmp : s) {
    cin >> tmp;
  }
  int t = 0, mod = 10;
  int m = 0;
  for (int i = 0; i < 5; i++) {
    if (s[i] % 10 == min(mod, s[i] % 10) && s[i] % 10 != 0) {
      mod = s[i] % 10;
      m = i;
      t += ((s[i] / 10) + 1) * 10;
    } else if (s[i] % 10 == 0) {
      t += s[i];
    }
  }
  cout << t - (10 - mod) << endl;
  return 0;
}
