public static int pwr(int base,int exp,int n){
		if(exp==0){
			return 1;
		}
		if(exp==1)
			return base%n;
		if(exp%2==0){
			int tmp=pwr(base,exp/2,n);
			return ((tmp%n)*(tmp%n)%n);
		}
		
		else
			return ((base%n)*pwr(base,exp-1,n))%n;
	}