1 #include<bits/stdc++.h>
2 #define ll long long
3 #define M 100005
4 using namespace std;
5 ll n,m,k,num,ss;
6 int l,r,mid;
7 ll x[M],y[M];
8 bool Flag;
9 struct node{ ll x,y; }b[M],a[M],q[M];
10 bool cmp(node x,node y){
11 if (x.x!=y.x) return x.x<y.x;
12 else return x.y<y.y;
13 }
14 int main(){
15 scanf("%lld%lld%lld",&n,&m,&k);
16 for (int i=1;i<=m;i++)
17 scanf("%lld%lld",&a[i].x,&a[i].y);
18 l=1; r=m;
19 while (l<=r){
20 mid=(l+r)>>1;
21 for (int i=1;i<=mid;i++) b[i]=a[i];
22 sort(b+1,b+1+mid,cmp);
23 int cnt=0;
24 if (b[1].x>1) q[++cnt].x=1,q[cnt].y=b[1].x-1;
25 ll Max=b[1].y;
26 for (int i=2;i<=mid;i++){
27 if (b[i].x-Max>1) q[++cnt].x=Max+1,q[cnt].y=b[i].x-1;
28 if (b[i].y>Max) Max=b[i].y;
29 }
30 if (Max<n) q[++cnt].x=Max+1,q[cnt].y=n;
31 bool flag=false;
32 num=0; int p=1;
33 ll last=0,s;
34 if (!k){
35 if (cnt>0) flag=true;
36 } else
37 while (p<=cnt){
38 if (q[p].x<=last&&q[p].y>last) q[p].x=last+1; else
39 if (q[p].y<=last){
40 p++; continue;
41 }
42 s=(q[p].y-q[p].x)/k+1;
43 num=num+s;
44 if (num>mid){
45 flag=true; break;
46 }
47 last=q[p].x+s*k-1;
48 p++;
49 }
50 if (flag) l=mid+1; else{
51 Flag=true;
52 ss=mid;
53 r=mid-1;
54 }
55 }
56 if (!Flag) puts("Poor Douer!");
57 else printf("%d\n",ss);
58 return 0;
59 }