#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int mod = 1000000000 + 7;
int dp[101][4][4][4];
int main() {
  vector<int> Time(5), nextTime(5);
  for (int i = 0; i < 5; i++) {
    cin >> Time[i];
  }
  {
    for (int i = 0; i < Time.size(); i++) {
      cout << Time[i] << " ";
    }
    cout << endl;
  };
  for (int i = 0; i < 5; i++) {
    nextTime[i] = (Time[i] + 9) / 10 * 10;
  }
  {
    for (int i = 0; i < nextTime.size(); i++) {
      cout << nextTime[i] << " ";
    }
    cout << endl;
  };
  int ans = (int)1e9;
  for (int i = 0; i < 5; i++) {
    int res = 0;
    for (int j = 0; j < 5; j++) {
      if (i == j) {
        res += Time[j];
      } else {
        res += nextTime[j];
      }
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}
