Determinant#2694

Determinant

1 second
64 megabytes
Very easy

A combinatorial matrix of order is a square matrix with rows and columns, where each element is determined by the formula:

A_{i, j} = X + \delta_{i, j} \cdot Y, with and being arbitrary numbers.

Your task is to compute the determinant of this combinatorial matrix of order , given the numbers and . Since the result can be very large, you should provide the determinant modulo .

Input

The input consists of a single line containing four integers: , , , and .

2 \leq N \leq 2^{31} - 1; X \leq 1000; Y \leq 1000; 1 \leq K \leq 10000.

Output

Output a single integer, which is the remainder when the determinant of the combinatorial matrix is divided by .

Examples

Example 1

Loading
Loading