#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int A, B, C, D, E;
  if (a % 10 == 0) {
    A = a;
  } else {
    A = (a / 10 + 1) * 10;
  }
  if (b % 10 == 0) {
    B = b;
  } else {
    B = (b / 10 + 1) * 10;
  }
  if (a % 10 == 0) {
    C = c;
  } else {
    C = (c / 10 + 1) * 10;
  }
  if (a % 10 == 0) {
    D = d;
  } else {
    D = (d / 10 + 1) * 10;
  }
  if (e % 10 == 0) {
    E = e;
  } else {
    E = (e / 10 + 1) * 10;
  }
  int mi = 10;
  if (mi > a % 10) {
    mi = a % 10;
  }
  if (mi > b % 10) {
    mi = b % 10;
  }
  if (mi > c % 10) {
    mi = c % 10;
  }
  if (mi > d % 10) {
    mi = d % 10;
  }
  if (mi > e % 10) {
    mi = e % 10;
  }
  cout << A + B + C + D + E - 10 + mi << endl;
  return 0;
}
