1332_E. Height All the Same
Alice has got addicted to a game called Sirtet recently.

In Sirtet, player is given an n × m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player can perform the following operations: 

  * stack up one cube in two adjacent cells; 
  * stack up two cubes in one cell. 



Cubes mentioned above are identical in height.

Here is an illustration of the game. States on the right are obtained by performing one of the above operations on the state on the left, and grey cubes are added due to the operation.

<image>

Player's goal is to make the height of all cells the same (i.e. so that each cell has the same number of cubes in it) using above operations. 

Alice, however, has found out that on some starting grids she may never reach the goal no matter what strategy she uses. Thus, she is wondering the number of initial grids such that 

  * L ≤ a_{i,j} ≤ R for all 1 ≤ i ≤ n, 1 ≤ j ≤ m; 
  * player can reach the goal using above operations. 



Please help Alice with it. Notice that the answer might be large, please output the desired value modulo 998,244,353.

Input

The only line contains four integers n, m, L and R (1≤ n,m,L,R ≤ 10^9, L ≤ R, n ⋅ m ≥ 2).

Output

Output one integer, representing the desired answer modulo 998,244,353.

Examples

Input


2 2 1 1


Output


1


Input


1 2 1 2


Output


2

Note

In the first sample, the only initial grid that satisfies the requirements is a_{1,1}=a_{2,1}=a_{1,2}=a_{2,2}=1. Thus the answer should be 1.

In the second sample, initial grids that satisfy the requirements are a_{1,1}=a_{1,2}=1 and a_{1,1}=a_{1,2}=2. Thus the answer should be 2.
```python
import io
import os

from collections import Counter, defaultdict, deque

DEBUG = False


def modInverse(a, p):
    # Fermat's little theorem, a**(p-1) = 1 mod p
    return pow(a, p - 2, p)


def solve(N, M, L, R):
    MOD = 998244353

    num = R - L + 1
    numCells = N * M

    # Answer doesn't have to lie with L and R so can always add 2 so that only parity matters
    # Once it's a 0 and 1 matrix, adding to two adjacent is equivalent to a swap, so order doesn't matter
    # If the number of odd cells is even or number of even cells is even, flip their parity so the matrix is all odd or all even
    if numCells % 2 == 1:
        # Anything works since one of the parity must be even count
        return pow(num, numCells, MOD)

    # If num cells is even, can't have odd even cells and odd odd cells. Can only have even even cell and even odd cells
    # Want to choose `2 * i` odd cells within numCells
    # Once parity is fixed the number of choices is numOdds^(2 * i) * numEvens^(numCells - 2 * i)

    # Plug into wolfram alpha:
    # numCells = 2 * K
    # \sum_{i=0}^{K} binomial(2 * K, 2 * i) * X^(2 * i) * Y^(2 * K - 2 * i)
    K = numCells // 2
    X = num // 2  # number of values within range [L, R] that are odd
    Y = num // 2  # ditto for even
    if num % 2 != 0:
        if L % 2 == 0:
            X += 1
        else:
            Y += 1

    assert numCells % 2 == 0

    ans = (
        (pow(X + Y, numCells, MOD) + pow(X - Y, numCells, MOD)) * modInverse(2, MOD)
    ) % MOD
    if DEBUG:

        def nCr(n, r):
            def fact(i):
                if i == 0:
                    return 1
                return i * fact(i - 1)

            return fact(n) // (fact(n - r) * fact(r))

        brute = 0
        for i in range(numCells // 2 + 1):
            brute += nCr(numCells, 2 * i) * pow(X, 2 * i) * pow(Y, numCells - 2 * i)
        print(brute % MOD, ans)
        assert brute % MOD == ans

    return ans


if DEBUG:
    for n in range(1, 5):
        for m in range(1, 5):
            for l in range(1, 5):
                for r in range(l, 5):
                    if n * m < 2:
                        continue
                    solve(n, m, l, r)


if __name__ == "__main__":
    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

    N, M, L, R = [int(x) for x in input().split()]
    ans = solve(N, M, L, R)
    print(ans)

```