#include <bits/stdc++.h>
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;
int a[5];
int ans = 1e9;
void solve() {
  for (int i = 0; i < 5; i++) cin >> a[i];
  do {
    int sum = 0;
    for (int i = 0; i < 4; i++) {
      cout << a[i] << ' ';
      int x = (a[i] % 10 == 0) ? a[i] : (a[i] / 10 + 1) * 10;
      sum += x;
    }
    ans = min(sum + a[4], ans);
  } while (next_permutation(a, a + 5));
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  int q = 1;
  while (q--) solve();
}
