Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/for-darajalar-yigindisi

Sum of powers

Medium 1000 ms 64 MB 44%
Share

Positive integers $N$ and $k$ are given. Compute the sum:

$$S = 1^{k} + 2^{k} + 3^{k} + \dots + N^{k}$$

The sum of the k-th powers of numbers

Input

One line with two positive integers: $N$ and $k$.

Output

One integer — the sum.

Note

$1 \le N \le 20$
$1 \le k \le 10$

Examples

Input #1
3 2
Output #1
14
Input #2
4 3
Output #2
100

Sign in to submit a solution

Signing up is free and takes a minute.