#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 0;
  int min = 10;
  for (int i = 0; i < 5; i++) {
    int tmp;
    int left;
    cin >> tmp;
    left = tmp % 10;
    if (left == 0) {
      left = 10;
    }
    sum = sum + tmp + (10 - left);
    if (min > left) {
      min = left;
    }
  }
  sum = sum - min;
  cout << sum << endl;
}
