#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  vector<long long> men(5);
  int sum = 0;
  int m = 10;
  for (int i = 0; i < 5; i++) {
    cin >> men[i];
  }
  for (int i = 0; i < 5; i++) {
    m = min(m, (int)(men[i] % 10));
  }
  for (int i = 0; i < 5; i++) {
    int a = men[i] / 10;
    sum += a * 10 + 10;
  }
  cout << sum - 10 + m << endl;
}
