1299: fireworks

内存限制:64 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:47 解决:20

题目描述

Hmz likes to play fireworks, especially when they are put regularly.
Now he puts some fireworks in a line. This time he put a trigger on each firework. With that trigger, each firework will explode and split into two parts per second, which means if a firework is currently in position
x, then in next second one part will be in position x1 and one in x+1. They can continue spliting without limits, as Hmz likes.

Now there are n fireworks on the number axis. Hmz wants to know after T seconds, how many fireworks are there in position w?


输入

Input contains multiple test cases.
For each test case:

  • The first line contains 3 integers n,T,w(n,T,|w|≤105)
  • In next n lines, each line contains two integers xi and ci, indicating there are ci fireworks in position xi at the beginning(ci,|xi|≤105).

输出

For each test case, you should output the answer MOD 1000000007.

样例输入 复制

1 2 0
2 2
2 2 2
0 3
1 2

样例输出 复制

2
3