#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
using PII = pair<int, int>;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using V = vector<T>;
template <class T>
using V2 = vector<vector<T>>;
template <class T, int W = 255>
using A = array<T, W>;
template <class T, int W = 255, int H = 255>
using A2 = array<array<T, W>, W>;
V<PII> v;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int x;
  for (int i = 0; i < static_cast<int>(5); i++) {
    cin >> x;
    v.push_back(PII((x % 10 == 0) ? 124 : x % 10, x / 10));
  }
  std::sort((v).begin(), (v).end(),
            [](const PII& x, const PII& y) { return x.first > y.first; });
  int s = 0;
  for (int i = 0; i < static_cast<int>(4); i++) {
    if (v[i].first == 124)
      s += v[i].second * 10;
    else
      s += (v[i].second + 1) * 10;
  }
  cout << s + (v[4].first + v[4].second * 10) << "\n";
}
