add pow(x,n) solution