#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) {
  if (a == 1) {
    return false;
  }
  if (a == 2) {
    return true;
  }
  if (a % 2 == 0) {
    return false;
  }
  for (int i = 3; i < sqrt(a) + 1; i += 2) {
    if (a != i) {
      if (a % i == 0) {
        return false;
      }
    }
  }
  return true;
}
struct setupios {
  setupios() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  };
} setupios;
int main() {
  int sum = 0;
  int mini = 10000007;
  for (long long i = 0; i < 5; i++) {
    int a;
    cin >> a;
    sum += a;
    if (a % 10 != 0) {
      sum += 10 - a % 10;
    }
    if (mini > a % 10 and a % 10 != 0) {
      mini = a % 10;
    }
  }
  cout << sum - (10 - mini) << endl;
}
