#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class Cut { public:
	static bool TensFirst(int a, int b)
	{
		if(a%10 != b%10)
			return a%10 < b%10;
		return a < b;
	}

	int getMaximum(vector <int> eelLengths, int maxCuts)
	{
		sort(eelLengths.begin(), eelLengths.end(), &TensFirst);

		int una = 0;
		for(int i=0; i<eelLengths.size(); ++i) {
			int e = eelLengths[i];
			while( maxCuts && e>10 )
				una++, maxCuts--, e-=10;
			if( e == 10 )
				una++;
		}
		return una;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, Cut().getMaximum(eelLengths, maxCuts));}
int main(){

CASE(0)
	int eelLengths_[] = {13, 20, 13};
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = 2; 
	int _ = 3; 
END
CASE(1)
	int eelLengths_[] = {5, 5, 5, 5};
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = 2; 
	int _ = 0; 
END
CASE(2)
	int eelLengths_[] = {34, 10, 48};
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = 4; 
	int _ = 5; 
END
CASE(3)
	int eelLengths_[] = {30, 50, 30, 50};
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = 350; 
	int _ = 16; 
END
/*
CASE(4)
	int eelLengths_[] = ;
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = ; 
	int _ = ; 
END
CASE(5)
	int eelLengths_[] = ;
	  vector <int> eelLengths(eelLengths_, eelLengths_+sizeof(eelLengths_)/sizeof(*eelLengths_)); 
	int maxCuts = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
