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