#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = (A - 1) / 10 * 10 + 10;
  int b = (B - 1) / 10 * 10 + 10;
  int c = (C - 1) / 10 * 10 + 10;
  int d = (D - 1) / 10 * 10 + 10;
  int e = (E - 1) / 10 * 10 + 10;
  vector<int> vec = {A, B, C, D, E};
  int ans = a + b + c + d + e;
  int Ans;
  for (int i = 9; i > 0; i = i - 1) {
    for (int j = 0; j < 5; j++) {
      if (vec.at(j) % 10 == i) {
        Ans = ans + i - 10;
      }
    }
  }
  cout << Ans << endl;
}
