#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  for (int i = 0; i < 5; ++i) {
    cin >> v.at(i);
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    ans += v.at(i);
    ans = (ans + 10 - 1) / 10 * 10;
  }
  int x;
  int mn = 1000;
  for (int i = 0; i < 5; ++i) {
    x = v.at(i) % 10;
    if (x == 0) {
      continue;
    }
    mn = min(mn, x);
  }
  ans -= 10 - mn;
  cout << ans << endl;
}
