#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int mod_A, mod_B, mod_C, mod_D, mod_E;
  mod_A = A % 10;
  mod_B = B % 10;
  mod_C = C % 10;
  mod_D = D % 10;
  mod_E = E % 10;
  int Ad10, Bd10, Cd10, Dd10, Ed10;
  Ad10 = (A + 9) / 10;
  Bd10 = (B + 9) / 10;
  Cd10 = (C + 9) / 10;
  Dd10 = (D + 9) / 10;
  Ed10 = (E + 9) / 10;
  int ans;
  if (mod_A != 0 &&
      (mod_A < mod_B && mod_A < mod_C && mod_A < mod_D && mod_A < mod_E)) {
    ans = (Bd10 + Cd10 + Dd10 + Ed10) * 10 + A;
  }
  if (mod_B != 0 &&
      (mod_B < mod_A && mod_B < mod_C && mod_B < mod_D && mod_B < mod_E)) {
    ans = (Ad10 + Cd10 + Dd10 + Ed10) * 10 + B;
  }
  if (mod_C != 0 &&
      (mod_C < mod_A && mod_C < mod_B && mod_C < mod_D && mod_C < mod_E)) {
    ans = (Ad10 + Bd10 + Dd10 + Ed10) * 10 + C;
  }
  if (mod_D != 0 &&
      (mod_D < mod_A && mod_D < mod_B && mod_D < mod_C && mod_D < mod_E)) {
    ans = (Ad10 + Bd10 + Cd10 + Ed10) * 10 + D;
  }
  if (mod_E != 0 &&
      (mod_E < mod_A && mod_E < mod_B && mod_E < mod_C && mod_E < mod_D)) {
    ans = (Ad10 + Bd10 + Cd10 + Dd10) * 10 + E;
  }
  if (mod_A == 0 && mod_B == 0 && mod_C == 0 && mod_D == 0 && mod_E == 0) {
    ans = (Ad10 + Bd10 + Cd10 + Dd10 + Ed10) * 10;
  }
  cout << ans;
}
