#include <bits/stdc++.h>
using namespace std;
int main() {
  int vals[5];
  for (int i = 0; i < 5; i++) {
    cin >> vals[i];
  }
  int sum = 0;
  int min = 200;
  int chagrge;
  for (int i = 0; i < 5; i++) {
    chagrge = vals[i] % 10;
    if (chagrge < min && chagrge != 0) {
      min = chagrge;
    }
    int ans = vals[i] / 10;
    if (chagrge != 0) {
      sum += (ans + 1) * 10;
    } else {
      sum += (ans)*10;
    }
  }
  sum -= 10;
  sum += min;
  cout << sum << endl;
  return 0;
}
