#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int i = 0, j = 0;
  int a[5] = {};
  vector<int> last;
  int ans = 0;
  for (int(i) = 0; (i) < (5); (i)++) {
    cin >> a[i];
  }
  for (int(i) = 0; (i) < (5); (i)++) {
    if (a[i] % 10 == 0)
      ans = ans + a[i];
    else {
      ans = ans + a[i] - (a[i] % 10);
      last.push_back(a[i] % 10);
    }
  }
  sort(last.begin(), last.end());
  ans = ans + ((last.size() - 1) * 10) + last[0];
  cout << ans << "\n";
}
