#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> abc(5);
  for (int i = 0; i < 5; i++) {
    cin >> abc[i];
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    ans += abc[i];
    abc[i] = abc[i] % 10;
  }
  sort(abc.begin(), abc.end());
  int o = 0;
  for (int i = 1; i < 5; i++) {
    if (abc[i] == 0) {
      continue;
    } else if (o == 1) {
      ans += 10 - abc[i];
    } else {
      o++;
    }
  }
  cout << ans << endl;
}
