#include <bits/stdc++.h>
using namespace std;
int main() {
  int dish[5];
  for (int i = 0; i < 5; i++) {
    cin >> dish[i];
  }
  int idx;
  int trade = 9;
  for (int i = 0; i < 5; i++) {
    if (dish[i] % 10 != 0 && trade > dish[i] % 10) {
      idx = i;
      trade = dish[i] % 10;
    }
  }
  int temp = dish[idx];
  dish[idx] = dish[4];
  dish[4] = temp;
  for (int i = 0; i < 4; i++) {
    while (dish[i] % 10 != 0) {
      dish[i] += 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += dish[i];
  }
  cout << sum << endl;
  return 0;
}
