#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) cin >> a[i];
  int min = 9;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 > 0 && a[i] % 10 <= min) min = a[i] % 10;
  }
  int smallest;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == min) {
      smallest = a[i];
      a[i] = 0;
      min = 11;
    } else {
      while (a[i] % 10 != 0) a[i]++;
    }
  }
  int sum = smallest;
  for (int i = 0; i < 5; i++) {
    sum += a[i];
  }
  cout << sum << endl;
  return 0;
}
