PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000085. Chim đậu trên dây (Birds on a Wire)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Chim đậu trên dây (Birds on a Wire)

Birds on a Wire

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

A wire has endpoints at 00 and LL. Every bird must sit at least 66 meters from either endpoint; every pair of birds must be at least dd meters apart. There are nn existing birds at valid integer positions xix_i; none may be moved. Find the maximum number of additional birds that can be placed at integer coordinates.

Input

The first line contains L,d,nL,d,n. If n>0n>0, the next line contains nn integer positions xix_i.

Output

Print the maximum number of additional birds.

Subtasks

  • Subtask 1 (20 points): 12≤L≤10312\le L\le10^3; 1≤d≤L1\le d\le L; 0≤n≤120\le n\le12; 6≤xi≤L−66\le x_i\le L-6; existing positions are distinct and separated by at least dd.
  • Subtask 2 (30 points): 12≤L≤10612\le L\le10^6; 1≤d≤L1\le d\le L; 0≤n≤20000\le n\le2000; 6≤xi≤L−66\le x_i\le L-6; existing positions are distinct and separated by at least dd.
  • Subtask 3 (50 points): 12≤L≤10912\le L\le10^9; 1≤d≤L1\le d\le L; 0≤n≤1050\le n\le10^5; 6≤xi≤L−66\le x_i\le L-6; existing positions are distinct and separated by at least dd.

Examples

Input

25 4 2
10 18

Output

2

Explanation

You can add birds at positions 66 and 1414, both at distance at least 44 from the existing birds at 1010 and 1818. No further legal position exists before the right margin L−6=19L-6=19, so the answer is 22.