Mountain routes#122

Mountain routes

1 second
128 megabytes
Easy (≈1000)

The mountain tourist complex consists of tourist bases connected by mountain passes (other routes in the mountains are considered dangerous). Any passage between two bases takes day. A tourist group is at base and plans to reach base in no more than days. How many different (cycle-free) routes are there from to ?

prb122.gif

Input

The first line contains five numbers: , , , , (n \le 50, d \le 10), separated by spaces. Each of the following lines contains a pair of numbers describing a possible mountain pass. All numbers are positive integers.

Output

Print one integer — the number of such routes.

Examples

Example 1

Loading
Loading