Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler!
However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has nmarks, with which he can make measurements. We assume that the marks are numbered from 1 to n in the order they appear from the beginning of the ruler to its end. The first point coincides with the beginning of the ruler and represents the origin. The last mark coincides with the end of the ruler, at distance l from the origin. This ruler can be repesented by an increasing sequence a1, a2, ..., an, where ai denotes the distance of the i-th mark from the origin (a1 = 0, an = l).
Valery believes that with a ruler he can measure the distance of d centimeters, if there is a pair of integers i and j (1 ≤ i ≤ j ≤ n), such that the distance between the i-th and the j-th mark is exactly equal to d (in other words, aj - ai = d).
Under the rules, the girls should be able to jump at least x centimeters, and the boys should be able to jump at least y (x < y) centimeters. To test the children's abilities, Valery needs a ruler to measure each of the distances x and y.
Your task is to determine what is the minimum number of additional marks you need to add on the ruler so that they can be used to measure the distances x and y. Valery can add the marks at any integer non-negative distance from the origin not exceeding the length of the ruler.
The first line contains four positive space-separated integers n, l, x, y (2 ≤ n ≤ 105, 2 ≤ l ≤ 109, 1 ≤ x < y ≤ l) — the number of marks, the length of the ruler and the jump norms for girls and boys, correspondingly.
The second line contains a sequence of n integers a1, a2, ..., an (0 = a1 < a2 < ... < an = l), where ai shows the distance from the i-th mark to the origin.
In the first line print a single non-negative integer v — the minimum number of marks that you need to add on the ruler.
In the second line print v space-separated integers p1, p2, ..., pv (0 ≤ pi ≤ l). Number pi means that the i-th mark should be at the distance of pi centimeters from the origin. Print the marks in any order. If there are multiple solutions, print any of them.
3 250 185 230 0 185 250
1 230
4 250 185 230 0 20 185 250
0
2 300 185 230 0 300
2 185 230
#include <bits/stdc++.h>
#define maxn 100005
#define MOD 1000000007
using namespace std;
typedef long long ll;
int n, l, x, y;
int num[maxn];
bool judge(int d){
int h = lower_bound(num, num+n, d) - num;
if(num[h] == d)
return true;
return false;
}
int main(){
// freopen("in.txt", "r", stdin);
int s1 = 0, s2 = 0;
scanf("%d%d%d%d", &n, &l, &x, &y);
for(int i = 0; i < n; i++)
scanf("%d", num+i);
for(int i = 0; i < n; i++){
if(!s1 && l - x >= num[i] && judge(x+num[i]))
s1 = 1;
if(!s1 && num[i] - x >= 0 && judge(num[i]-x))
s1 = 1;
if(!s2 && l - y >= num[i] && judge(y+num[i]))
s2 = 1;
if(!s2 && num[i] - y >= 0 && judge(num[i]-y))
s2 = 1;
if(s1 && s2)
break;
}
if(s1 && s2){
puts("0");
return 0;
}
if(s1 == 0 && s2 == 1){
printf("%d\n%d\n", 1, x);
return 0;
}
if(s2 == 0 && s1 == 1){
printf("%d\n%d\n", 1, y);
return 0;
}
for(int i = 0; i < n; i++){
if(l - x >= num[i]){
int d = x + num[i];
if(l - y >= d && judge(y+d)){
puts("1");
printf("%d\n", d);
return 0;
}
if(d - y >= 0 && judge(d-y)){
puts("1");
printf("%d\n", d);
return 0;
}
}
if(num[i] - x >= 0){
int d = num[i] - x;
if(l - y >= d && judge(y+d)){
puts("1");
printf("%d\n", d);
return 0;
}
if(d - y >= 0 && judge(d-y)){
puts("1");
printf("%d\n", d);
return 0;
}
}
}
puts("2");
printf("%d %d\n", x, y);
return 0;
}