#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int inf = 1e18;
int main() {
  long long int x[5];
  cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  long long int s = 0;
  for (int i = 0; i < 5; i++) {
    if (x[i] % 10 == 0)
      ;
    else
      s = max(x[i] / 10 * 10 + 10 - x[i], s);
  }
  long long int l = 0;
  for (int i = 0; i < 5; i++) l += x[i] / 10 * 10 + 10;
  cout << l - s << endl;
}
