#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0, m = 9;
  bool b = false;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    ans += (a + 9) / 10 * 10;
    if (a % 10 != 0) {
      if (m % 10 > a % 10) {
        b = true;
        m = a;
      }
    }
  }
  if (b) ans -= 10 - m % 10;
  cout << ans << endl;
}
