import System

power x n | n > 0 = powerf x n 1
          | n == 0 = 1
          | x == 1 = 1
          | n < 0 = 1/(powerf x (-n) 1)
          | x == 0 = 0
          | otherwise = error "Not valid input"

powerf x n r | n > 0 = let {r' = r*x; n' = n - 1} in powerf x n' r'
             | n == 0 = r

main = do {a:b:_ <- getArgs; print $ power (read a) (read b)}
