#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1e9) + 7;
const long double EPS = 0.0000001;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int arr[5];
  for (int i = 0; i < 5; i++) cin >> arr[i];
  vector<pair<int, int> > v;
  for (int i = 0; i < 5; i++) {
    v.push_back(make_pair(arr[i] % 10, arr[i]));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int ans = 0;
  int tim = 0;
  for (int i = 0; i < 5; i++) {
    if (i == 4)
      tim = tim + v[i].second;
    else {
      int x = v[i].second;
      if (x % 10) {
        x = x / 10;
        x++;
      } else {
        x = x / 10;
      }
      tim += x * 10;
    }
  }
  cout << tim << endl;
  return 0;
}
