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