#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b,c,d,e,k,l,m,n,;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0){
    while (a % 10 ==0 ){
      a++;
    }
  }
  k = a + b;
  if (k % 10 != 0){
    while (k % 10 == 0){
      k++;
    }
  }
  l += c;
  if (l % 10 != 0){
    while (l % 10 == 0){
      l++;
    }
  }
  m += d;
  if (m % 10 != 0){
    while (m % 10 == 0){
      m++;
    }
  }
  n += e;
  cout << n << endl;
}
