#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int min = 10000;
  int sum;
  for (int i = 0; i < 5; i++) {
    sum = 0;
    for (int j = 0; j < 5; j++) {
      if (j != i) {
        a[j] = (a[j] / 10) * 10 + 10;
      }
      sum = sum + a[j];
    }
    if (sum < min) {
      min = sum;
    }
  }
  cout << min << endl;
  return 0;
}
