#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;
  a = A % 10;
  b = B % 10;
  c = C % 10;
  d = D % 10;
  e = E % 10;
  int f, g, h, i, j, k;
  f = A + B + C + D + E + 40 - a - b - c - d - e;
  if (a == 0) {
    f -= 10;
    a = 100;
  }
  if (b == 0) {
    f -= 10;
    b = 100;
  }
  if (c == 0) {
    f -= 10;
    c = 100;
  }
  if (d == 0) {
    f -= 10;
    d = 100;
  }
  if (e == 0) {
    f -= 10;
    e = 100;
  }
  cout << min(f + a, min(f + b, min(f + c, min(f + d, f + e)))) << endl;
}
