Kalel, the Jumping Frog

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

문제

Kalel is a frog that likes jumping over stones.

There are NN stones in a row, numbered from 11 to NN from left to right. Kalel begins at stone 11 and he wants to reach stone NN.

At each move, Kalel can choose among MM types of jump. The jj-th jump allows him to jump from stone xx to stone x+d_jx + d\_j and costs p_jp\_j energy points. It may happen that p_jp\_j equals 00 for some jj. You can assume Kalel never runs out of energy.

Given NN and KK, calculate in how many ways Kalel can reach stone NN spending at most KK energy points in total. Two ways are considered different if the sequence of jump choices is different. As this number can become very large, we are only interested in its remainder modulo 10910^9 (one billion).

입력

The first line contains three integers, NN, MM and KK (1N1091 ≤ N ≤ 10^9, 1M1051 ≤ M ≤ 10^5, 0K4000 ≤ K ≤ 400). The next MM lines contain two integers each, the numbers d_jd\_j and p_jp\_j (1d_j101 ≤ d\_j ≤ 10, 0p_jK0 ≤ p\_j ≤ K).

출력

Print a single line, containing in how many different ways Kalel can get to the rock NN spending a maximum of KK energy points, modulus 10910^9 (one billion).