1643. Ares, Toilet Ares

Ares is the Greek god of courage and war. He is one of the Twelve Olympians and the son of Zeus and Hera. In Greek literature, he often represents the physical or violent and untamed aspect of war and is the personification of sheer brutality and bloodlust, in contrast to his sister, the armored Athena, whose functions as a goddess of intelligence include military strategy and generalship.

A Toilet-Ares appeared at the western hub of the mysterious East. They took part in ShengJing AUPC(abnormal university programming competition). There are nn problems in this competition. For some irresistible reason, the Toilet-Ares had got solutions to all of the problems. To ensure the fairness of AUPC, the groups of problems' authors changed the problems immediately. They changed nmn-m problems in total and enhanced data ranges of simplest aa of the rest mm unchanged problems. The Toilet-Ares seemed to have a little intelligence to solve the simplest aa of unchanged problems, while they seemed not willing to pass harder ones for fear of being exposed(or maybe because they didn't get solutions to the harder ones). They have kk chances to go to the toilet. Every time they go to toilet, they can attain xix_i lines of code related to the problem 'k', while has pip_i probability (in the form of yz\frac{y}{z} , 0yz<49330 \leq y \leq z < 4933) of failure in solving the problem. Notice that the length of code to solve problem 'k' is ll. It is guaranteed that xi=l\sum x_i = l.

输入

The first line of input contains five integers n,m,k,a,l(1amn109,1l109,1k105)n,m,k,a,l(1\le a\le m\le n\le10^9, 1\le l\le10^9, 1\le k\le10^5)

Then kk lines follows, each line contains three integers xi,yi,zi(0xi109,0yizi4933)x_i,y_i,z_i(0\le x_i\le10^9, 0\le y_i\le z_i\le4933)

It is guaranteed that xi=l\sum x_i=l .

输出

One line contains one number donating the number of problems which the Toilet-Ares can accept. The answer is proved to be a fraction as pq\frac pq . Please output the fraction in module 49334933 . (By the way, 49334933 is a special number which consists of two double digits)

样例

标准输入 复制文本
5 3 2 1 5
2 2 3
3 3 4
标准输出 复制文本
4523

提示

In this case, the answer is 1+1/3*1/4=13/12, and it's equal to 4523 in module 4933.

出处:2021牛客暑期多校训练营8 A题

不保证数据与原题一致

登录以提交代码。
单点时限 1 秒
内存限制 128 MB
提交 13
通过 3