#52Easy
Sum of powers
Time: 1 s · Memory: 256 MB
- Nested loops
Statement
You are given natural numbers and . Find .
Input format
A single line with two integers and (, ).
Output format
A single integer — the sum.
Examples
Input
3 4
Output
98
Input
5 1
Output
15
Note
Compute each with an inner loop (multiply by times) while the outer loop runs from to . returns a floating-point number and loses precision on large values.
