private void measureableHelper(int sand1,int sand2,int time,int glass1,int glass2){
		if(time > 500 || visited[sand1][sand2][time])
			return;
		visited[sand1][sand2][time] = true;
		set.add(time);
		
		if(sand1==0 || sand2 == 0){
			measureableHelper(glass1-sand1, sand2, time, glass1, glass2);
			measureableHelper(sand1, glass2-sand2, time, glass1, glass2);
			measureableHelper(glass1-sand1, glass2-sand2, time, glass1, glass2);
			if(sand1 > 0)
				measureableHelper(0, 0, time+sand1, glass1, glass2);
			else if(sand2 > 0)
				measureableHelper(0, 0, time+sand2, glass1, glass2);
		}
		else{
			int mini = Math.min(sand1, sand2);
			measureableHelper(sand1-mini, sand2-mini, time+mini, glass1, glass2);
		}
	}