add n power m problem