#P478. 练86.1 旅行

练86.1 旅行

Description

You are planning a 7000KM journey. There are some motels along the way, and for safety reasons, you will not drive at night and will stay at motels. You already have a list of motels identified by their distance from the starting point:
0, 990, 1010, 1970, 2030, 2940, 3060
3930, 4060, 4970, 5030, 5990, 6010, 7000
However, more motels may be added before departure.
The travel agency requires you to drive at least AA kilometers per day to save costs, while the national travel agency requires you to drive at most BB kilometers per day for safety reasons.
You want to know how many different travel plans are possible.

Input Format

The first line contains AA, the second line contains BB, and the third line contains NN (0N200 ≤ N ≤ 20), representing the number of additional motels to be added before departure. The next NN lines each contain an integer mm, representing the distance of a motel from the starting point (0<m<70000 < m < 7000). Note: no two motels are at the same location.

Output Format

Output the total number of possible travel plans.

Sample

500
1500
0
64