static int swap(int x, int k){
		int pos = 0;
		while((x/pow[pos])%10>0){
			pos++;
		}
		int tp = 0;
		if(k==0){
			if(pos+4>7)return 0;
			tp = pos+4;
		}
		else if(k==1){
			if((pos+1)%4==0)return 0;
			tp = pos+1;
		}
		else if(k==2){
			if(pos-4<0)return 0;
			tp = pos-4;
		}
		else if(k==3){
			if(pos%4==0)return 0;
			tp = pos-1;
		}
		int d = x/pow[tp]%10;
		return x - d*pow[tp] + d*pow[pos];
	}