Ares, Toilet Ares
题号:NC225346
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

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  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  problems in total and enhanced data ranges of simplest  of the rest  unchanged problems. The Toilet-Ares seemed to have a little intelligence to solve the simplest  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  chances to go to the toilet. Every time they go to toilet, they can attain x_i lines of code related to the problem 'k', while has p_i probability (in the form of , ) of failure in solving the problem. Notice that the length of code to solve problem 'k' is . It is guaranteed that .

输入描述:

The first line of input contains five integers  . 

Then  lines follows, each line contains three integers x_i, y_i, z_i .

It is guaranteed that .

输出描述:

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 . Please output the fraction in module . (By the way,  is a special number which consists of two double digits)
示例1

输入

复制
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.