#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> w(5);
  w[0] = abs(a - (a / 10) * 10);
  w[1] = abs(b - (b / 10) * 10);
  w[2] = abs(c - (c / 10) * 10);
  w[3] = abs(d - (d / 10) * 10);
  w[4] = abs(e - (e / 10) * 10);
  int wmin = 11;
  int wmax = -1;
  int minid = 0;
  int maxid = 4;
  for (int i = 0; i < 5; i++) {
    if (wmin > w[i] && w[i] != 0) {
      minid = i;
      wmin = w[i];
    }
    if (wmax < w[i]) {
      maxid = i;
      wmax = w[i];
    }
  }
  vector<int> input{a, b, c, d, e};
  int minval = input[minid];
  int maxval = input[maxid];
  int ans = maxval;
  for (int i = 0; i < 5; i++) {
    if (i == maxid) {
      continue;
    } else if (i == minid) {
      continue;
    } else {
      if (ans % 10 != 0) {
        ans = (ans / 10 + 1) * 10;
        ans += input[i];
      } else {
        ans += input[i];
      }
    }
  }
  if (ans % 10 != 0) {
    ans = (ans / 10 + 1) * 10;
    ans += minval;
  } else {
    ans += minval;
  }
  cout << ans << endl;
  return 0;
}
