#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main() {
  int len[5] = {0};
  int result = 0;
  int minRest = 1145141919;
  for (int i = 0; i < (5); i++) {
    cin >> len[i];
    int mod = len[i] % 10;
    if (mod == 0) {
      result += ((len[i] / 10) * 10);
    } else {
      result += ((len[i] / 10) * 10) + 10;
      minRest = min(minRest, mod);
    }
  }
  cout << (result - 10 + minRest) << endl;
}
