solve :: Int -> Int -> Int -> Int
solve k a b = b^p + m
  where
    n = k - a + 1
    (d,m) = n `divMod` 2
    p = (b `div` a) ^ (d-1)

main :: IO ()
main = do
    [k,a,b] <- map read . words <$> getLine :: IO [Int]
    print $ if a + 1 < b
               then solve k a b else k + 1
