#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> a(5);
  int Min = 1000, s = 0;
  for (int i = 0; i < (5); ++i) {
    cin >> a[i];
    s += 10 * ((a[i] - 1) / 10 + 1);
    if (a[i] % 10 != 0) Min = min(Min, a[i] % 10);
  }
  cout << s + Min - 10 << endl;
  return 0;
}
