Disorder
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given integers (n) and (m), your task is to determine the total number of non-monotonic sequences of length (n), where each element is a non-negative integer not greater than (m).
A sequence is considered monotonic if its elements either do not decrease or do not increase as the index progresses.
Input
The first line contains the integer (n), and the second line contains the integer (m) ((1 n 10), (0 m 30)).
Output
Output a single line containing the answer to the problem.
Examples
Input #1
Answer #1
Submissions 139
Acceptance rate 38%