#include <bits/stdc++.h>
using namespace std;
int main() {
  int dish[5];
  int time = 100;
  for (int i = 0; i < 5; i++) {
    cin >> dish[i];
    if (dish[i] % 10 != 0) {
      time = min(time, dish[i] % 10);
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (dish[i] == time) {
      dish[i] = 0;
      break;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (dish[i] % 10 == 0) {
      ans += dish[i];
    } else {
      ans += dish[i] + (10 - dish[i] % 10);
    }
  }
  cout << ans + time << endl;
}
