#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
const int INF = 100000;
int n;
int main() {
  int a[5];
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    sum += a[i];
  }
  cout << sum << endl;
  int x = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      continue;
    }
    sum += ((a[i] / 10) + 1) * 10 - a[i];
    x = max(x, ((a[i] / 10) + 1) * 10 - a[i]);
  }
  cout << sum - x << endl;
}
