아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Kalel, the Jumping Frog

시간 제한18초메모리 제한1024 MB

요약
길이 1에서 10까지, 각기 다른 에너지를 쓰는 점프를 사용해 개구리가 돌 1에서 돌 N까지 총 K 이하의 에너지로 도달하는 방법의 수를 10^9로 나눈 나머지를 구한다.
난이도

보통10점 중 7점

유형
동적 계획법, 행렬, 조합론
정답자
아직 제출이 없습니다

문제

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 (1≤N≤1091 ≤ N ≤ 10^9, 1≤M≤1051 ≤ M ≤ 10^5, 0≤K≤4000 ≤ K ≤ 400). The next MM lines contain two integers each, the numbers d_jd\_j and p_jp\_j (1≤d_j≤101 ≤ d\_j ≤ 10, 0≤p_j≤K0 ≤ 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).

예제2

  1. 예제 1

    입력
    5 3 10
    1 3
    2 0
    3 1
    
    예상 출력
    6
    
  2. 예제 2

    입력
    100000 3 10
    1 9
    2 0
    7 3
    
    예상 출력
    85449877