#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  int min = 9;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 < min) {
      min = a[i] % 10;
    }
    sum += 10 * ceil(a[i] / 10);
  }
  sum = sum - 10 + min;
  return 0;
}
