#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  vector<int> A(5);
  int ans = 0;
  int min = 9;
  for (int i = 0; i < (int)(5); i++) {
    cin >> A.at(i);
    if (A.at(i) % 10 != 0) {
      if (min > A.at(i) % 10) {
        min = A.at(i) % 10;
      }
      A.at(i) = A.at(i) / 10 + 1;
    } else {
      A.at(i) /= 10;
    }
    ans += A.at(i) * 10;
  }
  cout << ans + min - 10 << endl;
}
