public int minBoxes(int C, int X, int[] low, int[] high)
	{
		int res = 0;
		int unknownNum = 0;
		int ex = C;
		for(int i=0;i<low.length;i++){
			ex -= low[i];
			unknownNum = high[i] - low[i];
		}
		
		int m = 0;
		int mIndex = 0;
		while(0<X){
			if(unknownNum > 0){
				for(int i=0;i<low.length;i++){
					if(low[i] > m){
						m = low[i];
						mIndex = i;
					}	
				}
			}else{
				for(int i=0;i<low.length;i++){
					if(ex > high[i]-low[i]){
						if(high[i] > m){
							m = high[i];
							mIndex = i;
						}
					}else{
						if(ex+low[i] > m){
							m = ex+low[i];
							mIndex = i;
						}
					}
				}
			}
			
			res++;
			unknownNum -= (high[mIndex] - low[mIndex]);
			low[mIndex] = 0;
			high[mIndex] = 0;
			X -= m;
			m = 0;
		}
		
		
		return res;
	}