#include <bits/stdc++.h>
using namespace std;
const int INF = 100000001;
int main() {
  int t[5];
  int ind = -1;
  int max = 0;
  for (int i = 0; i < 5; i++) {
    cin >> t[i];
    for (int j = 0; j < 13; j++) {
      if (10 * j - t[i] >= 0) {
        if (10 * j - t[i] >= max) {
          ind = i;
          max = 10 * j - t[i];
        }
        break;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == ind) {
      continue;
    }
    for (int j = 0; j < 13; j++) {
      if (10 * j < t[i] && t[i] <= 10 * j + 10) {
        ans += 10 * j + 10;
        break;
      }
    }
  }
  ans += t[ind];
  cout << ans << endl;
  return 0;
}
