#include <bits/stdc++.h>
using namespace std;
int main() {
  int k[5];
  int w[5];
  for (int i = 0; i < (int)(5); i++) {
    int q;
    cin >> q;
    k[i] = q;
    w[i] = ((q - 1) / 10 + 1) * 10;
  }
  int ans = 10000000;
  for (int z = 0; z < (int)(5); z++) {
    int e = 0;
    for (int c = 0; c < (int)(5); c++) {
      e += k[c];
    }
    e = e - k[z] + w[z];
    ans = min(ans, e);
  }
  cout << ans << endl;
}
