#include <bits/stdc++.h>
using namespace std;
bool comp(pair<string, long long int> a, pair<string, long long int> b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long int n = 5;
  long long int arr[n];
  long long int sum = 0, d = INT_MIN;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
    if (arr[i] % 10) {
      sum += 10 - arr[i] % 10;
      d = max(d, 10 - arr[i] % 10);
    }
  }
  cout << sum - d;
}
