#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5, 0);
  for (int i = 0; i < (int)5; i++) cin >> a[i];
  int t = 0;
  for (int i = 0; i < (int)5; i++) t += a[i] / 10 * 10;
  cout << endl;
  for (int i = 0; i < (int)5; i++) cout << a[i] << endl;
  for (int i = 0; i < (int)5; i++) a[i] = a[i] % 10;
  sort(a.begin(), a.end());
  cout << endl;
  for (int i = 0; i < (int)5; i++) cout << a[i] << endl;
  int flag = 0;
  for (int i = 0; i < (int)5; i++) {
    if (a[i] == 0) continue;
    if (flag == 1)
      t += 10;
    else {
      t += a[i];
      flag = 1;
    }
  }
  cout << t << endl;
}
