#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int min = 9999;
  int temp = 0;
  int A, B, C, D, E;
  int a[5];
  cin >> A >> B >> C >> D >> E;
  a[0] = A;
  a[1] = B;
  a[2] = C;
  a[3] = D;
  a[4] = E;
  do {
    for (int i = 0; i < 4; ++i) {
      for (int j = 0; j <= a[i]; j += 10) {
        temp = j;
      }
      count += temp;
    }
    count += a[4];
    if (min > count) min = count;
    count = 0;
    temp = 0;
  } while (next_permutation(a, a + 4));
  cout << min << endl;
  return 0;
}
