#P1515. 旅行

旅行

Description

You are going to take a trip of 70007000 kilometers. There are some motels along the way. For safety, you do not drive at night and stay in motels. You already have a list of motels, identified by their distance from the starting point, as follows:

  • $[0,990,1010,1970,2030,2940,3060,3930,4060,4970,5030,5990,6010,7000]$.

However, some motels may be added before departure.

To save costs, the travel agency requires that you drive at least AA kilometers each day. For safety, the national travel agency requires that you drive at most BB kilometers each day.

You want to know how many travel plans there are in total.

Input Format

The first line contains an integer AA. The second line contains an integer BB. The third line contains an integer NN (0N200 \le N \le 20), indicating that NN additional motels are added before departure.

The next NN lines each contain an integer mm, which is 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 travel plans.

500
1500
0

64

Hint

Translated by ChatGPT 5