#include <bits/stdc++.h>
using namespace std;
int amari(int &x) { return x % 10; }
int tens(int &x) { return x / 10 * 10; }
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = amari(A);
  int b = amari(B);
  int c = amari(C);
  int d = amari(D);
  int e = amari(E);
  int plus10 = 0;
  vector<int> amaris(5);
  amaris = {a, b, c, d, e};
  for (int x : amaris) {
    if (x != 0) {
      plus10++;
    }
  }
  int plus = min({a, b, c, d, e});
  int ans =
      tens(A) + tens(B) + tens(C) + tens(D) + tens(E) + plus10 * 10 + plus - 10;
  cout << ans << endl;
  return 0;
}
