#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int menu[5];
  int mod[5];
  int ans = 0;
  int last = 10;
  int id = 0;
  for (int i = 0; i < 5; i++) {
    cin >> menu[i];
    mod[i] = menu[i] % 10;
    if ((last > mod[i]) && (mod[i] != 0)) {
      last = menu[i];
      id = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (mod[i] == 0 || id == i) {
      ans += menu[i];
    } else {
      ans += menu[i] + (10 - mod[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
