#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<long long> min1(5);
  min1[0] = a % 10;
  min1[1] = b % 10;
  min1[2] = c % 10;
  min1[3] = d % 10;
  min1[4] = e % 10;
  long long min5 = 10;
  for (long long i = 0; i < (long long)(5); i++) {
    if (min1[i] != 0 && min1[i] < min5) min5 = min1[i];
  }
  cout << 10 * ((a - 1) / 10) + 10 * ((b - 1) / 10) + 10 * ((c - 1) / 10) +
              10 * ((d - 1) / 10) + 10 * ((e - 1) / 10) + 50 - min5
       << endl;
}
