High Powers

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Given are integers ss, tt, and uu.

Let aa, bb, and cc be distinct complex numbers that satisfy the following conditions:

  • a+b+c=sa+b+c=s,
  • ab+bc+ca=tab + bc + ca=t,
  • abc=uabc=u.

It is guaranteed that such aa, bb, and cc exist for the given ss, tt, and uu.

Given positive integers nn and mm, calculate the ratio

an(bmcm)+bn(cmam)+cn(ambm)(ab)(bc)(ca)\frac{a^n(b^m-c^m)+b^n(c^m-a^m)+c^n(a^m-b^m)}{(a-b)(b-c)(c-a)}

modulo 998,244,353998\\,244\\,353.

입력

The first line of input contains two integers nn and mm (1n,m10181 \le n, m \le 10^{18}).

The second line contains three integers ss, tt and uu (0s,t,u<998,244,3530 \le s, t, u < 998\\,244\\,353).

It is guaranteed that the distinct complex numbers aa, bb, and cc from the statement exist for the given ss, tt, and uu.

출력

It can be shown that the answer can be represented as a rational number p/qp/q where pp and qq are integers, (p,q)=1(p,q)=1, q>0q>0 and qq is not divisible by 998,244,353998\\,244\\,353.