#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<long long> mod(5);
  vector<bool> tyuumon(5, false);
  vector<long long> amari(1, 100000007);
  long long time = 0;
  mod.at(0) = A % 10;
  mod.at(1) = B % 10;
  mod.at(2) = C % 10;
  mod.at(3) = D % 10;
  mod.at(4) = E % 10;
  time = A / 10 + B / 10 + C / 10 + D / 10 + E / 10;
  time *= 10;
  for (int i = 0; i < (int)(5); i++) {
    if (mod.at(i) == 0) {
      tyuumon.at(i) = true;
    } else {
      amari.push_back(mod.at(i));
      time += 10;
    }
  }
  sort(amari.begin(), amari.end());
  time = time - 10 + amari.at(0);
  cout << time << endl;
}
