#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int aa = a % 10;
  int bb = b % 10;
  int cc = c % 10;
  int dd = d % 10;
  int ee = e % 10;
  int mins = 100;
  if (aa != 0) {
    mins = min(aa, mins);
  }
  if (bb != 0) {
    mins = min(mins, bb);
  }
  if (cc != 0) {
    mins = min(cc, mins);
  }
  if (dd != 0) {
    mins = min(mins, dd);
  }
  if (ee != 0) {
    mins = min(mins, ee);
  }
  int as, bs, cs, ds, es;
  if (a % 10 == 0) {
    as = a / 10;
  } else {
    as = a / 10 + 1;
  }
  if (b % 10 == 0) {
    bs = b / 10;
  } else {
    bs = b / 10 + 1;
  }
  if (c % 10 == 0) {
    cs = c / 10;
  } else {
    cs = c / 10 + 1;
  }
  if (d % 10 == 0) {
    ds = d / 10;
  } else {
    ds = d / 10 + 1;
  }
  if (e % 10 == 0) {
    es = e / 10;
  } else {
    es = e / 10 + 1;
  }
  cout << 10 * (as + bs + cs + ds + es) - 10 + mins << endl;
}
