#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, n;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0) {
    while (a % 10 == 0) {
      a++;
    }
  }
  n = a + b;
  if (n % 10 != 0) {
    while (n % 10 == 0) {
      n++;
    }
  }
  n += c;
  if (n % 10 != 0) {
    while (n % 10 == 0) {
      n++;
    }
  }
  n += d;
  if (n % 10 != 0) {
    while (n % 10 == 0) {
      n++;
    }
  }
  n += e;
  cout << n << endl;
}
