#include <bits/stdc++.h>
int main() {
  std::vector<int> a(5);
  for (int i = 0; i < 5; i++) std::cin >> a[i];
  int sum = 0;
  int rem = 9;
  bool flag = false;
  for (int i = 0; i < 5; i++) {
    int r = a[i] % 10;
    int q = a[i] / 10;
    if (r == 0) {
      sum += q * 10;
    } else {
      sum += (q + 1) * 10;
      if (r < rem) {
        rem = r;
        flag = true;
      }
    }
  }
  if (flag) {
    std::cout << sum - 10 + rem << std::endl;
  } else {
    std::cout << sum << std::endl;
  }
}
