#P5907. Summation of Power-Weighted Geometric Series

    ID: 19133 Type: Default 1000ms 256MiB

Summation of Power-Weighted Geometric Series

Summation of Power-Weighted Geometric Series

Given three integers \(n\), \(a\), and \(k\), compute the summation:

\[ S = \sum_{i=1}^{n} i^k \cdot a^i \]

Return the answer modulo \(998244353\).

inputFormat

The input consists of a single line containing three space-separated integers: \(n\), \(a\) and \(k\).\

outputFormat

Output a single integer, the value of \(S\) modulo \(998244353\).

sample

3 2 1
34