#include <bits/stdc++.h>
using namespace std;
void solve() {
  vector<int> v;
  v.resize(5);
  for (int i = 0; i < v.size(); i++) cin >> v[i];
  int ret = 643;
  mt19937 g1;
  for (int qq = 0; qq < 1000; qq++) {
    shuffle(v.begin(), v.end(), g1);
    int curr = 0;
    for (int out : v) {
      if (curr % 10) {
        curr += 10;
        curr -= curr % 10;
      }
      curr += out;
    }
    ret = min(ret, curr);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
