require "big" MOD = 998244353i64 n, p, q = read_line.split.map(&.to_i) if p == 1 && q == 1 puts 1 exit elsif p == 1 || q == 1 puts 2 exit end a = Array.new(n) { |i| i } a[...p] = a[...p].reverse a[-q..] = a[-q..].reverse ans = BigInt.new(1) visited = Array.new(n, false) n.times do |i| next if visited[i] cur = i len = 0 while !visited[cur] visited[cur] = true len += 1 cur = a[cur] end ans = ans.lcm(BigInt.new(len)) end puts ans * 2 % MOD