Logical error fixed in the powmod function,TO SLOW