#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  vector<int> v(5);
  for (int i = 0; i < (int)(5); i++) {
    cin >> v[i];
  }
  int min = 11;
  for (int i = 0; i < (int)(5); i++) {
    int c = v[i] % 10;
    if (c == 0) {
      ans += v[i];
    } else {
      ans += v[i] + (10 - c);
    }
    if (c != 0 && min > c) {
      min = c;
    }
  }
  cout << ans - (10 - min) << endl;
}
