#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 200000000;
const int MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> dish(5);
  for (int i = 0; i < (5); i++) {
    int a;
    cin >> a;
    dish[i] = a;
  }
  int min_r = 10;
  int min_index = 0;
  for (int i = 0; i < (5); i++) {
    if (dish[i] % 10 < min_r && dish[i] % 10 != 0) {
      min_r = dish[i] % 10;
      min_index = i;
    }
  }
  int sum = 0;
  for (int i = 0; i < (5); i++) {
    sum += dish[i];
    if (dish[i] % 10 != 0) {
      sum += 10 - (dish[i] % 10);
    }
  }
  sum -= (10 - (dish[min_index] % 10));
  cout << sum << endl;
  return 0;
}
