#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0) {
    a = a + 10;
  }
  if (b % 10 != 0) {
    b = b + 10;
  }
  if (c % 10 != 0) {
    c = c + 10;
  }
  if (d % 10 != 0) {
    d = d + 10;
  }
  if (e % 10 != 0) {
    e = e + 10;
  }
  if (a % 10 == 1 || b % 10 == 1 || c % 10 == 1 || d % 10 == 1 || e % 10 == 1) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 9
         << endl;
  } else if (a % 10 == 2 || b % 10 == 2 || c % 10 == 2 || d % 10 == 2 ||
             e % 10 == 2) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 8
         << endl;
  } else if (a % 10 == 3 || b % 10 == 3 || c % 10 == 3 || d % 10 == 3 ||
             e % 10 == 3) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 7
         << endl;
  } else if (a % 10 == 4 || b % 10 == 4 || c % 10 == 4 || d % 10 == 4 ||
             e % 10 == 4) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 6
         << endl;
  } else if (a % 10 == 5 || b % 10 == 5 || c % 10 == 5 || d % 10 == 5 ||
             e % 10 == 5) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 5
         << endl;
  } else if (a % 10 == 6 || b % 10 == 6 || c % 10 == 6 || d % 10 == 6 ||
             e % 10 == 6) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 4
         << endl;
  } else if (a % 10 == 7 || b % 10 == 7 || c % 10 == 7 || d % 10 == 7 ||
             e % 10 == 7) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 3
         << endl;
  } else if (a % 10 == 8 || b % 10 == 8 || c % 10 == 8 || d % 10 == 8 ||
             e % 10 == 8) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 2
         << endl;
  } else if (a % 10 == 9 || b % 10 == 9 || c % 10 == 9 || d % 10 == 9 ||
             e % 10 == 9) {
    cout << (a / 10) * 10 + (b / 10) * 10 + (c / 10) * 10 + (d / 10) * 10 +
                (e / 10) * 10 - 1
         << endl;
  }
}
