finished power mod function, woring on miller rabin