#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e9+10;

set <int > S;
int main()
{
	//freopen("", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(1);
	srand(time(NULL));
	int n = rand() % 500;
	n++;
	cout << n << endl;
	while (S.size() < n)
		S.insert(rand() % 1000000);
	for (set <int> :: iterator it = S.begin(); it != S.end(); it++)
		cout << *it << ' ' << rand() % 1000000 + 1 << endl;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e9+10;

set <int > S;
int main()
{
	//freopen("", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(5);
	srand(time(NULL));
	int n = rand() % 500;
	n++;
	cout << n << endl;
	while (S.size() < n)
		S.insert(rand() % 1000000);
	for (set <int> :: iterator it = S.begin(); it != S.end(); it++)
		cout << *it << ' ' << rand() % 1000000 + 1 << endl;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874
#define x1 x95874
#define x0 x952874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int MAXN = (int)1e3+5;
const int INF = (int)1e9+10;
const int N = 100;
const int M = (int)1e5;

class mirror {
public:
	int point, x1, x2;
	bool used;
	mirror () {}
};

class line {
public:
	ld k, b;
	line () {}
	line(ld x1, ld y1, ld x2, ld y2) {
		k = (y2 - y1) / (x2 - x1);
		b = (y1 - k * x1);
	}
};

inline ld getx(ld y, line L) {
	return (y - L.b) / L.k;
}

mirror up[MAXN], down[MAXN], nup[MAXN];

int n, h1, h2, n1, n2, maxans = 0;

inline void Cclear() {
	for (int i = 0; i < n1; i++)
		up[i].used = 0;
	for (int i = 0; i < n2; i++)
		down[i].used = 0;
	return;
}

inline bool ok1(ld x, int &ind) {
	for (int i = 0; i < n2; i++)
		if (x >= down[i].x1 && x <= down[i].x2) {
			ind = i;
			return true;
		}
	return false;
}

inline bool ok2(ld x, int &ind) {
	for (int i = 0; i < n1; i++)
		if (x >= up[i].x1 && x <= up[i].x2) {
			ind = i;
			return true;
		}
	return false;
}
int main()
{
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(5);
	cin >> h1 >> h2 >> n;
	for (int i = 0; i < n; i++) {
		int p, x1, x2;
		char c;
		cin >> p >> c >> x1 >> x2;
		if (c == 'T') {
			up[n1].point = p;
			up[n1].x1 = x1;
			up[n1].x2 = x2;
			n1++;
		} else {
			down[n2].point = p;
			down[n2].x1 = x1;
			down[n2].x2 = x2;
			n2++;
		}
	}
	ld x1 = 0, y1 = h1, x2 = M, y2 = h2;
	for (int kol = 1; kol < 110; kol++) {
		Cclear();
		int curans = 0, good = 1;
		if (kol % 2)
			y2 = -(kol - 1) * N - h2;
		else
			y2 = -(kol - 1) * N - (N - h2);
		//cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		//cout << "kol = " << kol << " : " << y2 << endl;
		line L = line(x1, y1, x2, y2);
		//cout << "Line = " << L.k << ' ' << L.b << endl;
		for (int cy = 0; cy < kol; cy++) {
			ld cury = (ld)cy * -100.0;
			//cout <<"cury = " << cury << " : " << getx(cury, L) << endl;
			if (cy % 2 == 0) {
				int ind;
				bool f = ok1(getx(cury, L), ind);//down
				//cout << "F = " << f << endl;
				//if (f) cout << "IND = " << ind << endl;
				if (f && !down[ind].used) {
					curans += down[ind].point;
					//cout << "CURANS = " << curans << endl;
					down[ind].used = 1;
				} else {
					good = 0;
					break;
				}
			} else {
				int ind;
				bool f = ok2(getx(cury, L), ind);//up
				if (f && !up[ind].used)  {
					curans += up[ind].point;
					up[ind].used = 1;
				} else {
					good = 0;
					break;
				}
			}
		}
		if (good)
			maxans = max(maxans, curans);
	}
	/*int nn = n1;
	n1 = n2;
	for (int i = 0; i < nn; i++)
		nup[i] = up[i];
	for (int i = 0; i < n1; i++)
		up[i] = down[i];
	n2 = nn;
	for (int i = 0; i < n2; i++)
		down[i] = nup[i];*/
	for (int kol = 1; kol < 110; kol++) {
		Cclear();
		int curans = 0, good = 1;
		if (kol % 2)
			y2 = kol * N + N - h2;
		else
			y2 = kol * N + N;
		//cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		//cout << "kol = " << kol << " : " << y2 << endl;
		line L = line(x1, y1, x2, y2);
		//cout << "Line = " << L.k << ' ' << L.b << endl;
		for (int cy = 0; cy < kol; cy++) {
			ld cury = (ld)cy * 100.0;
			//cout <<"cury = " << cury << " : " << getx(cury, L) << endl;
			if (cy % 2 == 1) {
				int ind;
				bool f = ok1(getx(cury, L), ind);//down
				//cout << "F = " << f << endl;
				//if (f) cout << "IND = " << ind << endl;
				if (f && !down[ind].used) {
					curans += down[ind].point;
					//cout << "CURANS = " << curans << endl;
					down[ind].used = 1;
				} else {
					good = 0;
					break;
				}
			} else {
				int ind;
				bool f = ok2(getx(cury, L), ind);//up
				if (f && !up[ind].used)  {
					curans += up[ind].point;
					up[ind].used = 1;
				} else {
					good = 0;
					break;
				}
			}
		}
		if (good)
			maxans = max(maxans, curans);
	}
	cout << maxans;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e9+10;

set <int > S;
int main()
{
	//freopen("", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
	srand(time(NULL));
	int n = rand() % 500;
	n++;
	cout << n << endl;
	while (S.size() < n)
		S.insert(rand() % 1000000);
	for (set <int> :: iterator it = S.begin(); it != S.end(); it++)
		cout << *it << ' ' << rand() % 1000000 + 1 << endl;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e19+10;

set <int > S;
int main()
{
	//freopen("", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(2);
	srand(time(NULL));
	int n = rand() % 500;
	n++;
	cout << n << endl;
	while (S.size() < n)
		S.insert(rand() % 1000000);
	for (set <int> :: iterator it = S.begin(); it != S.end(); it++)
		cout << *it << ' ' << rand() % 1000000 + 1 << endl;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e9+10;

int main()
{
	//freopen("", "r", stdin);
	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(2);
	cout << 500 << endl;
	cout << 0 << ' ' << 1000000 << endl;
	for (int i = 1; i < 500; i++)
		cout << i << ' ' << 1 << endl;
    return 0;
}


#pragma comment(linker, "/STACK:16777216")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

#define bublic public:
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define y0 y32479
#define y1 y95874

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const ld pi = 3.1415926535897932384626433832795;
const ld eps = 1e-9;
const int N = (int)1e5+5;
const int INF = (int)1e9+10;

set <int > S;
int main()
{
	//freopen("", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
    cout.flags(ios::fixed);
    cout.precision(2);
	srand(time(0));
	int n = rand() % 500;
	n++;
	cout << n << endl;
	while (S.size() < n)
		S.insert(rand() % 1000000);
	for (set <int> :: iterator it = S.begin(); it != S.end(); it++)
		cout << *it << ' ' << rand() % 1000000 + 1 << endl;
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned
int ismirrf[100100];
int ismirrc[100100];
int how[110];
int wh[110];
char s[3];
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    double beg=clock();
#endif

	printf("500\n");
	int x=0;
	FOR(i,0,499)
	{
		printf("%d 30\n",x);
		x+=100;
	}
	printf("%d 1000000\n",x);
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned
int ismirrf[100100];
int ismirrc[100100];
int how[110];
int wh[110];
char s[3];
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    double beg=clock();
#endif

	printf("500\n");
	int x=50000;
	printf("0 50000\n");
	FOR(i,0,498)
	{
		x++;
		printf("%d 1\n",x);
	}
	printf("1000000 1000000\n",x);
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigneds
vector<double> radius;
vector<int> s;
vector<double> x,p;
int n;
void relax(int i, int j)
{
	double t=s[j];
	radius[i]=MIN(radius[i],(x[i]-x[t])*(x[i]-x[t])/(4*radius[t]));
}
double solve()
{
	radius.clear();
	s.clear();
	double sum=0;
	FOR(i,0,n)
	{
		radius.push_back(p[i]);
		FOR(j,0,MIN(s.size(),300))
		{
			relax(i,s.size()-j-1);
		}
		while ((s.size()) && (radius[s.size()-1]<radius[i]))
			s.pop_back();
		s.push_back(i);
		sum+=radius[i];
	}
	return sum;
}
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    double beg=clock();
#endif
	/*scanf("%d",&n);
	x.resize(n);
	p.resize(n);
	FOR(i,0,n)
		scanf("%lf%lf",&x[i],&p[i]);*/
	printf("500\n");
	int x=50000;
	printf("0 50000\n");
	FOR(i,0,498)
	{
		x+=2;
		printf("%d 1\n",x);
	}
	printf("100000 52000\n",x);
	//double res=solve();
	//printf("%.10lf\n",res);
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned
vector<pnt > a;
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    double beg=clock();
#endif

	printf("500\n");
	FOR(i,0,500)
	{
		LL v1=rand();
		LL v2=rand();
		U LL p=(v1<<16)+v2;
		p%=1000000;
		if (p==0)
			p=1000000;
		v1=rand();
		v2=rand();
	    LL x=(v1<<16)+v2;
		x%=1000000;
		if (x==0)
			x=1000000;
		a.push_back(mp(x,p));
	}
	sort(a.begin(),a.end());
	FOR(i,0,a.size())
		cout<<a[i].first<<" "<<a[i].second<<endl;
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigneds
vector<double> radius;
vector<int> s;
vector<double> x,p;
int n;
void relax(int i, int j)
{
	double t=s[j];
	radius[i]=MIN(radius[i],(x[i]-x[t])*(x[i]-x[t])/(4*radius[t]));
}
double solve()
{
	radius.clear();
	s.clear();
	double sum=0;
	FOR(i,0,n)
	{
		radius.push_back(p[i]);
		FOR(j,0,MIN(s.size(),300))
		{
			relax(i,s.size()-j-1);
		}
		while ((s.size()) && (radius[s.size()-1]<=radius[i]))
			s.pop_back();
		s.push_back(i);
		sum+=radius[i];
	}
	//cout<<s.size()<<endl;
	return sum;
}
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    double beg=clock();
#endif
	/*scanf("%d",&n);
	x.resize(n);
	p.resize(n);
	FOR(i,0,n)
		scanf("%lf%lf",&x[i],&p[i]);*/
	printf("500\n");
	int x=50000;
	printf("0 50000\n");
	int toadd=498;
	FOR(i,0,498)
	{
		x+=toadd;
		printf("%d %d\n",x,toadd);
		x+=toadd;
		toadd--;
	}
	printf("400000 400000\n",x);
	/*double res=solve();
	printf("%.10lf\n",res);*/
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigneds
vector<double> radius;
vector<int> s;
vector<double> x,p;
int n;
void relax(int i, int j)
{
	double t=s[j];
	radius[i]=MIN(radius[i],(x[i]-x[t])*(x[i]-x[t])/(4*radius[t]));
}
double solve()
{
	radius.clear();
	s.clear();
	double sum=0;
	FOR(i,0,n)
	{
		radius.push_back(p[i]);
		FOR(j,0,MIN(s.size(),300))
		{
			relax(i,s.size()-j-1);
		}
		while ((s.size()) && (radius[s.size()-1]<=radius[i]))
			s.pop_back();
		s.push_back(i);
		sum+=radius[i];
	}
	//cout<<s.size()<<endl;
	return sum;
}
double solve1()
{
	radius.clear();
	s.clear();
	double sum=0;
	FOR(i,0,n)
	{
		radius.push_back(p[i]);
		FOR(j,0,s.size())
		{
			relax(i,s.size()-j-1);
		}
		while ((s.size()) && (radius[s.size()-1]<=radius[i]))
			s.pop_back();
		s.push_back(i);
		sum+=radius[i];
	}
	//cout<<s.size()<<endl;
	return sum;
}
int main()
{
#ifdef Fcdkbear
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    double beg=clock();
#endif
	/*scanf("%d",&n);
	x.resize(n);
	p.resize(n);
	FOR(i,0,n)
		scanf("%lf%lf",&x[i],&p[i]);*/
	printf("500\n");
	int x=300000;
	printf("0 300000\n");
	int toadd=498;
	FOR(i,0,498)
	{
		x+=toadd;
		printf("%d %d\n",x,toadd);
		x+=toadd;
		toadd--;
	}
	printf("600000 600000\n",x);
	/*double res=solve();
	double res1=solve1();
	printf("%.10lf %.10lf\n",res,res1);*/
#ifdef Fcdkbear
    double end=clock();
    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
}


#pragma comment (linker, "/STACK:16777216")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <numeric>
#include <complex>
#include <string>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> pnt;

#define FI(i,a) for (int i=0; i<(a); ++i)
#define FOR(i,s,e) for (int i=(s); i<(e); ++i)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define V(t) vector < t >
#define sz size()
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):(-(a)))

#define dout(a) cerr << a << endl
#define sout(a) cerr << a << "  "

const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-11;
//*
char ch_ch_ch[1<<20];
string gs() {scanf("%s",ch_ch_ch); return string(ch_ch_ch);}
string gl() {gets(ch_ch_ch); return string(ch_ch_ch);}
inline int gi() {int x; scanf("%d",&x); return x;}
//*/

// code starts here

const int R = 5000;

void solution()
{
    cout << 303 << endl;
    cout << 0 << ' ' << R << endl;
    int x = 1;
    int xp = 0;
    for (int v = 301; v >= 1; --v)
    {
        while ( ((x) *1ll* (x)) / double(4 * R) < double(v)+eps) ++x;
        while ( ((x-xp) *1ll* (x-xp)) / double(4 * (v+1)) < double(v)+eps) ++x;
        printf("%d %d\n",x,v);
        xp=x;
    }
    while ( ((x-xp) *1ll* (x-xp)) / double(4 * (2)) < double(1000000)+eps) ++x;
    cout << x << ' ' << 1000000 << endl;
   // if ((x-2454)*1ll*(x-2454)/double(4 * 301) < 1000000) cout << "TRUE\n";
}

// code ends here

int main(int argc, char** argv)
{

#ifdef IGEL_ACM
    //freopen("in.txt","r",stdin);
    freopen("in.txt", "w", stdout);
    clock_t beg_time = clock();
#else
    //freopen(argv[1],"r",stdin);
  // freopen("elect.out", "w", stdout);
  // freopen("elect.in", "r", stdin);
#endif

        solution();

#ifdef IGEL_ACM
    fprintf(stderr,"*** Time: %.3lf ***\n",1.0*(clock()-beg_time)/CLOCKS_PER_SEC);
#endif

    return 0;
}


#pragma comment (linker, "/STACK:16777216")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <numeric>
#include <complex>
#include <string>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> pnt;

#define FI(i,a) for (int i=0; i<(a); ++i)
#define FOR(i,s,e) for (int i=(s); i<(e); ++i)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define V(t) vector < t >
#define sz size()
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):(-(a)))

#define dout(a) cerr << a << endl
#define sout(a) cerr << a << "  "

const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-11;
//*
char ch_ch_ch[1<<20];
string gs() {scanf("%s",ch_ch_ch); return string(ch_ch_ch);}
string gl() {gets(ch_ch_ch); return string(ch_ch_ch);}
inline int gi() {int x; scanf("%d",&x); return x;}
//*/

// code starts here

const int R = 10000;

void solution()
{
    cout << 305 << endl;
    cout << 0 << ' ' << R << endl;
    int x = 1;
    int xp = 0;
    for (int v = 303; v >= 1; --v)
    {
        while ( ((x) *1ll* (x)) / double(4 * R) < double(v)+eps) ++x;
        while ( ((x-xp) *1ll* (x-xp)) / double(4 * (v+1)) < double(v+1)+eps) ++x;
        printf("%d %d\n",x,v);
        xp=x;
    }
    while ( ((x-xp) *1ll* (x-xp)) / double(4 * (2)) < double(1000000+1)+eps) ++x;
    cout << x << ' ' << 1000000 << endl;
   // if ((x)*1ll*(x)/double(4 * R) < 1000000) cout << "TRUE\n";
}

// code ends here

int main(int argc, char** argv)
{

#ifdef IGEL_ACM
    //freopen("in.txt","r",stdin);
    freopen("in.txt", "w", stdout);
    clock_t beg_time = clock();
#else
    //freopen(argv[1],"r",stdin);
  // freopen("elect.out", "w", stdout);
  // freopen("elect.in", "r", stdin);
#endif

        solution();

#ifdef IGEL_ACM
    fprintf(stderr,"*** Time: %.3lf ***\n",1.0*(clock()-beg_time)/CLOCKS_PER_SEC);
#endif

    return 0;
}


#pragma comment (linker, "/STACK:16777216")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <numeric>
#include <complex>
#include <string>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> pnt;

#define FI(i,a) for (int i=0; i<(a); ++i)
#define FOR(i,s,e) for (int i=(s); i<(e); ++i)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define V(t) vector < t >
#define sz size()
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):(-(a)))

#define dout(a) cerr << a << endl
#define sout(a) cerr << a << "  "

const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-11;
//*
char ch_ch_ch[1<<20];
string gs() {scanf("%s",ch_ch_ch); return string(ch_ch_ch);}
string gl() {gets(ch_ch_ch); return string(ch_ch_ch);}
inline int gi() {int x; scanf("%d",&x); return x;}
//*/

// code starts here

const int R = 10000;

void solution()
{
    cout << 304 << endl;
    cout << 0 << ' ' << R << endl;
    int x = 1;
    int xp = 0;
    for (int v = 303; v >= 2; --v)
    {
        while ( ((x-xp) *1ll* (x-xp)) / double(4 * R) < double(v)+eps) ++x;
        printf("%d %d\n",x,v);
        xp=x;
    }
    cout << x+100000 << ' ' << R << endl;

}

// code ends here

int main(int argc, char** argv)
{

#ifdef IGEL_ACM
    //freopen("in.txt","r",stdin);
    freopen("in.txt", "w", stdout);
    clock_t beg_time = clock();
#else
    //freopen(argv[1],"r",stdin);
  // freopen("elect.out", "w", stdout);
  // freopen("elect.in", "r", stdin);
#endif

        solution();

#ifdef IGEL_ACM
    fprintf(stderr,"*** Time: %.3lf ***\n",1.0*(clock()-beg_time)/CLOCKS_PER_SEC);
#endif

    return 0;
}


#pragma comment (linker, "/STACK:16777216")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <numeric>
#include <complex>
#include <string>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> pnt;

#define FI(i,a) for (int i=0; i<(a); ++i)
#define FOR(i,s,e) for (int i=(s); i<(e); ++i)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define V(t) vector < t >
#define sz size()
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):(-(a)))

#define dout(a) cerr << a << endl
#define sout(a) cerr << a << "  "

const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-11;
//*
char ch_ch_ch[1<<20];
string gs() {scanf("%s",ch_ch_ch); return string(ch_ch_ch);}
string gl() {gets(ch_ch_ch); return string(ch_ch_ch);}
inline int gi() {int x; scanf("%d",&x); return x;}
//*/

// code starts here

const int R = 1000000;

void solution()
{
    cout << 305 << endl;
    cout << 0 << ' ' << R << endl;
    int x = 1;
    int xp = 0;
    for (int v = 303; v >= 1; --v)
    {
        while ( ((x) *1ll* (x)) / double(4 * R) < double(v)+eps) ++x;
        while ( ((x-xp) *1ll* (x-xp)) / double(4 * (v+1)) < double(v+1)+eps) ++x;
        printf("%d %d\n",x,v);
        xp=x;
    }
    while ( ((x-xp) *1ll* (x-xp)) / double(4 * (2)) < double(1000000+1)+eps) ++x;
    cout << x << ' ' << 1000000 << endl;
   // if ((x)*1ll*(x)/double(4 * R) < 1000000) cout << "TRUE\n";
}

// code ends here

int main(int argc, char** argv)
{

#ifdef IGEL_ACM
    //freopen("in.txt","r",stdin);
    freopen("in.txt", "w", stdout);
    clock_t beg_time = clock();
#else
    //freopen(argv[1],"r",stdin);
  // freopen("elect.out", "w", stdout);
  // freopen("elect.in", "r", stdin);
#endif

        solution();

#ifdef IGEL_ACM
    fprintf(stderr,"*** Time: %.3lf ***\n",1.0*(clock()-beg_time)/CLOCKS_PER_SEC);
#endif

    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("333\n");
    int x=1,p=1;
    for(int i=1;i<=333;i++)
    {
        printf("%d %d\n",x+5,p+6);
        x+=5;p+=6;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("500\n");
    int x=0,p=510;
    printf("0 1000000\n");
    for(int i=2;i<500;i++)
    {
        printf("%d %d\n" , x+1 , p);
        p--;   x++;
    }
    printf("%d 1000000\n",x+1);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("302\n");
    int x=0,p=510;
    printf("0 1000000\n");
    for(int i=0;i<300;i++)
    {
        printf("%d %d\n",40000+i*1000,n-i);
    }
    printf("1000000 1000000\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("300\n");
    int x=0,p=300;
    printf("1000000 0\n");
    for(int i=2;i<=300;i++)
    {
        printf("%d %d\n",p,x+1);
        p--;x++;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("333\n");
    int x=1,p=1;
    for(int i=1;i<=333;i++)
    {
        printf("%d %d\n",x+2,p+3);
        x+=2;p+=3;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("300\n");
    int x=0,p=310;
    printf("1000000 0\n");
    for(int i=2;i<=301;i++)
    {
        printf("%d %d\n",p,x+1);
        p--;x++;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("555\n");
    int x=1,p=1;
    for(int i=1;i<=555;i++)
    {
        printf("%d %d\n",x+5,p+6);
        x+=5;p+=6;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("300\n");
    int x=0,p=510;
    printf("1000000 0\n");
    for(int i=2;i<=500;i++)
    {
        printf("%d %d\n" , p , x+1);
        p--;   x++;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("302\n");
    int x=0,p=510;
    printf("0 1000000\n");
    for(int i=0;i<300;i++)
    {
        printf("%d %d\n",40000+i*1000,300-i);
    }
    printf("1000000 1000000\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("500\n");
    int x=0,p=451511;
    for(int i=1;i<=500;i++)
    {
        printf("%d %d\n",x+55,p);
        x+=55;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("500\n");
    int x=0,p=510;
    printf("1000000 0\n");
    for(int i=2;i<=500;i++)
    {
        printf("%d %d\n" , p , x+1);
        p--;   x++;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("300\n");
    int x=0,p=310;
    printf("1000000 0\n");
    for(int i=2;i<=305;i++)
    {
        printf("%d %d\n",p,x+1);
        p--;   x++;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("500\n");
    int x=1,p=1;
    for(int i=1;i<=500;i++)
    {
        printf("%d %d\n",x+5,p+6);
        x+=5;p+=6;
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<time.h>
#include<queue>
#include<cstdlib>
#include<algorithm>
using namespace std;
#define lowbit(x) ((x)&(-(x)))
#define sqr(x) ((x)*(x))
#define PB push_back
#define MP make_pair
typedef unsigned long long ULL;
typedef long long lld;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int maxn  =  100010;
const int mod = 1000000007;
vector<int> edge[1010];
int main()
{
    printf("500\n");
    int x=1000000,p=451511;
    for(int i=1;i<=500;i++)
    {
        printf("%d %d\n",x-55,p);
        x-=55;
    }
    return 0;
}


#include <cstdio>
#include <cmath>

using namespace std;
int dist(int R1, int R2) {
	return 2 * sqrt(R1*R2) + 1;
}

int main() {
	int curx  = 0;
	printf("302\n");
	int preR = 1000000;
	printf("%d %d\n", curx, preR);
	for(int r = 300; r >= 1; --r) {
		int d =  dist(preR, r);
		preR = r;
		curx += d;
		printf("%d %d\n", curx, r);
	}
	int R = 1000000;
	curx = 1000000;
	printf("%d %d\n", curx, R);
	return 0;
}


#include <cstdio>
#include <cmath>

using namespace std;
int dist(int R1, int R2) {
	return 2 * sqrt(R1*R2) + 1;
}

int main() {
	int curx  = 0;
	printf("402\n");
	int preR = 1000000;
	printf("%d %d\n", curx, preR);
	for(int r = 300; r >= 1; --r) {
		int d =  dist(preR, r);
		preR = r;
		curx += d;
		printf("%d %d\n", curx, r);
	}
	int R = 1000000;
	int nex = curx + dist(preR, R);
	curx += nex;
	printf("%d %d\n", curx, R);
	return 0;
}


#include <cstdio>

using namespace std;

int main() {
	int N = 402;
	printf("%d\n",N);
	printf("0 10000\n");
	for(int i = 0; i < 400; ++i) {
		printf("%d %d\n", i + 1, 1);
	}
	printf("10000 40000\n");
	return 0;
}


#include <cstdio>
#include <cmath>

using namespace std;
int dist(int R1, int R2) {
	return 2 * sqrt(R1*R2) + 1;
}

int main() {
	int curx  = 0;
	printf("402\n");
	int preR = 1000000;
	printf("%d %d\n", curx, preR);
	for(int r = 300; r >= 1; --r) {
		int d =  dist(preR, r);
		preR = r;
		curx += d;
		printf("%d %d\n", curx, r);
	}
	int R = 1000000;
	cur = 1000000;
	printf("%d %d\n", curx, R);
	return 0;
}


#include "cstdio"
#include "cstring"

using namespace std;

int main(void)
{
    printf("500\n");
    printf("0 100000\n");
    for(int i=0;i<498;i++)printf("%d %d\n",1000+i*2,1);
    printf("100000 100000\n");

    return 0;
}


#include "cstdio"
#include "cstring"

using namespace std;

int main(void)
{
    printf("500\n");
    printf("0 100000");
    for(int i=0;i<498;i++)printf("%d %d\n",1000+i*2,1);
    printf("100000 100000\n");

    return 0;
}


#include "cstdio"
#include "cstring"

using namespace std;

int main(void)
{
    printf("304\n");
    printf("0 100000\n");

    int pos=1000;

    for(int i=302;i>=1;i--)
    {
        printf("%d %d\n",pos,i);
        pos+=2*i-1;
    }

    printf("100000 100000\n");

    return 0;
}


#include "cstdio"
#include "cstring"

using namespace std;

int main(void)
{
    printf("304\n");
    printf("0 1000000\n");

    int pos=35000;

    for(int i=302;i>=1;i--)
    {
        printf("%d %d\n",pos,i);
        pos+=2*i-1;
    }

    printf("1000000 1000000\n");

    return 0;
}


#include "cstdio"
#include "cstring"

using namespace std;

int main(void)
{
    printf("304\n");
    printf("0 1000000\n");

    int pos=10000;

    for(int i=302;i>=1;i--)
    {
        printf("%d %d\n",pos,i);
        pos+=2*i-1;
    }

    printf("1000000 1000000\n");

    return 0;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%d 10000\n" , ans[i] ) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("632000 1000000\n" ) ;
    //repd( i , 632000 , ans[1]+1 ) {
        //if ( ( ( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 ) <= ( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] ) ) && ((( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )) <=1000000) ){
            //cout<<i<<endl;
            //cout<<( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )<<endl;
            //cout<<( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] )<<endl;
            //break ;
        //}
    //}
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    //freopen("data.in","w",stdout);
    double r = 100000 ;
    printf("402\n");
    long long last = 0 , num = 800 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000\n") ;
    repd( i , 400 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("1000000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",402);
    long long last = 0 , num = 800 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 400 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("1000000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("550000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    //freopen("data.in","w",stdout);
    double r = 500000 ;
    printf("302\n");
    long long last = 0 , num = 300 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num] = i ;
            rr[num] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 1 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 500000\n") ;
    repd( i , 300 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("1000000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("630000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d %d\n" , ans[i] , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("630000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[400] ;
double rr[400] ;
int main(){
    double r = 100000 ;
    printf("%d\n",352);
    long long last = 0 , num = 350 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            //cout<<i<<" "<<ans[num]<<endl;
            ans[num] = i ;
            //cout<<i<<" "<<ans[num]<<endl;
            rr[num] = (i-last)*(i-last)/(4*r) ;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -- ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    printf("0 100000\n") ;
    repd( i , 350 , 1 )
        printf("%d 10000\n" , ans[i] ) ;
    //return 0 ;
    printf("632000 1000000\n" ) ;
    //repd( i , 632000 , ans[1]+1 ) {
        //if ( ( ( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 ) <= ( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] ) ) && ((( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )) <=1000000) ){
            //cout<<i<<endl;
            //cout<<( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )<<endl;
            ////cout<<( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] )<<endl;
            //break ;
        //}
    //}
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("1000000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("600000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[400] ;
double rr[400] ;
int main(){
    double r = 100000 ;
    printf("%d\n",352);
    long long last = 0 , num = 350 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            //cout<<i<<" "<<ans[num]<<endl;
            ans[num] = i ;
            //cout<<i<<" "<<ans[num]<<endl;
            rr[num] = (i-last)*(i-last)/(4*r) ;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -- ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    printf("0 100000") ;
    repd( i , 350 , 1 )
        printf("%d 10000\n" , ans[i] ) ;
    //return 0 ;
    printf("632000 1000000\n" ) ;
    //repd( i , 632000 , ans[1]+1 ) {
        //if ( ( ( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 ) <= ( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] ) ) && ((( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )) <=1000000) ){
            //cout<<i<<endl;
            //cout<<( i - 0 ) * ( i - 0 )/ ( 4.0 *100000 )<<endl;
            ////cout<<( i - ans[1] ) * ( i - ans[1] )  / ( 4 * rr[1] )<<endl;
            //break ;
        //}
    //}
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("620000 1000000\n" ) ;
}


/*
 * Author:  whu_yixiaohan
 * Created Time:  2012/11/2 1:25:13
 * File Name: TestG.cpp
 */
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
using namespace std;
const double eps(1e-8);
#define clr(x) memset( x , 0 , sizeof(x) )
#define sz(v) ((long long)(v).size())
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repf(i, a, b) for (long long i = (a); i <= (b); ++i)
#define repd(i, a, b) for (long long i = (a); i >= (b); --i)
#define clrs( x , y ) memset( x , y , sizeof(x) )
long long ans[4000] ;
double rr[4000] ;
int main(){
    double r = 100000 ;
    printf("%d\n",502);
    long long last = 0 , num = 1000 ;
    repf( i , 1 , 1000000 ) {
        if ( (i-last)*(i-last)/(4.0*r) >= num ) {
            ans[num/2] = i ;
            rr[num/2] = (i-last)*(i-last)/(4*r) ;
            //cout<<num/2<<" "<<rr[num/2]<<endl;
            r = (i-last)*(i-last)/(4*r) ;
            last = i ;
            num -= 2 ;
            //cout<<num<<" "<<ans[num]<<endl;
        }
        if ( num == 0 ) break ;
    }
    //cout<<rr[1]<<endl;
    //return 0 ;
    printf("0 100000") ;
    repd( i , 500 , 1 )
        printf("%I64d 10000\n" , ans[i]);// , (int)floor(rr[i])+3) ;
    //cout<<ans[1]<<endl;
    //return 0 ;
    printf("580000 1000000\n" ) ;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;

struct aaa {
	int p, x;
};

aaa x[500];

bool cmp(aaa a, aaa b) {
	return a.x < b.x;
}

int main() {
	  srand ( time(NULL) );
	//freopen("ttt", "r", stdin);
	int i;

	cout << 500 << "\n";

	for(i = 1; i<=500; ++i)
		x[i].p = rand()%1000000, x[i].x = rand()%1000000;
	sort(x + 1, x + 500 + 1, cmp);

	for(i = 1; i<=500; ++i)
		cout << x[i].x << " " << x[i].p << "\n";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 300000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "500000 1000000\n";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 300000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "500000 500000";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 1000000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "500000 1000000\n";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 1;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 1\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "500000 500000\n";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 1000000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i * 2 << "\n";
		s+=i;
	}

	cout << "1000000 1000000\n";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 300000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "1000000 1000000";

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;

int main() {
	int i, s = 300000;

	//freopen("ttt", "r", stdin);

	cout << "500\n0 350000\n";

	for(i = 498; i; --i) {
		cout << s + i << " " << i << "\n";
		s+=i;
	}

	cout << "500000 500000\n";

	return 0;
}


#include <iostream>
#include <set>

using namespace std;

int main()
{
    set<int> a;
    int n,m,v[100010],x;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
        cin>>v[i];
    for(int i=1;i<=n;i++)
    {
        a.clear();
        cin>>x;
        for(int j=x;j<=n;j++)
            a.insert(v[j]);
        cout<<a.size()<<endl;
    }
    return 0;
}

// 1517684443025


#include <bits/stdc++.h>
using namespace std;

int main(){

	long n,m;
	cin>>n;
	cin>>m;
	long indices1[n],vecinos[n];
	long numeros[100005];
	for (long i=0;i<n;++i){
		cin>>indices1[i];
	}
	for (long i=0;i<100005;++i){
		numeros[i]=0;
	}
	vecinos[n-1]=1;
	for (long i=n-1;i>0;--i){
        long x=indices1[i-1];
		if (numeros[x]==0){
                numeros[x]=1;
		vecinos[i-1]=1+vecinos[i];
		}
		else vecinos[i-1]=vecinos[i];

	}
	for (long i=0;i<m;++i){
		long t;
		cin>>t;
		cout<<vecinos[t-1]<<endl;
	}
	return 0;
}
// 1523513727031


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
  long long int n, m;
  std::cin >> n;
  std::cin >> m;
  long long int a [n], dist[n];
  set<long long int> s;

  for (long long int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  for (long long int i = n-1; i >= 0; i--) {
    s.insert(a[i]);
    dist[i] = s.size();
  }

  long long int aux;
  for (long long int i = 0; i < m; i++) {
    std::cin >> aux;
    std::cout << dist[aux-1] << '\n';
  }
  return 0;
}

// 1523473503064


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n;
	cin>>m;
	vector<int> indices1(n,0);
	vector<int> indices2(m,0);
	vector<int> vecinos(n,0);
	vector<long> numeros(100005,0);
	for (int i=0;i<n;++i){
		cin>>indices1[i];
	}
	for (int i=0;i<m;++i){
		cin>>indices2[i];
	}
	for (int i=0;i<100005;++i){
		numeros[i]=0;
	}
	for (int i=0;i<n;++i){
		vecinos[i]=0;
	}
	for (int i=n-1;i>=0;--i){
        int x=indices1[i];
		if (numeros[x]==0){
                for(int j=0;j<i+1;++j)
                    {vecinos[j]++;}
		}
		numeros[x]++;
	}
	cout<<"x"<<endl;
	for (int i=0;i<m;i++){
        int t=indices2[i]-1;
		cout<<vecinos[t];
	}
	return 0;
}
// 1523502955888


#include<bits/stdc++.h>

using namespace std;

int main(){
	int n, m;

	cin >> n;
	cin >> m;

	int vals[100005] = {0};
	int dp[100005] = {0};
	bool v[100005];

	for(int i = 0; i < n; i++){
		cin >> vals[i];
	}

	for(int i = n - 1; i >= 0; i--){
		if(!v[vals[i]])
			dp[i]++;
		v[vals[i]] = true;
	}

	for(int i = n -1; i >=0; i--)
		dp[i] += dp[i + 1];

	int e;
	for(int i = 0; i < m; i++){
		cin >> e;
		cout << dp[e-1] << endl;
	}

	return 0;
}
// 1523488697631


#include <bits/stdc++.h>
using namespace std;
bool registro[1000001]={0};

int main(){
	int n, m;
	cin >> n >> m;

	int a[n], I[m], r[n];

	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < m; i++)
		cin >> I[i];

	r[n-1] = 1;
	registro[a[n]] = 1;
	for(int i = n - 2; i >= 0; i--){
			if(registro[a[i]])
				r[i] = r[i + 1];
			else{
				r[i] = (r[i+1] + 1);
				registro[a[i]] = 1;
			}
	}

	for(int i = 0; i < m; i++){
		int p = I[i] - 1;
		cout << r[p] << endl;
	}
}
// 1523483292442


#include <iostream>
#include <algorithm>
#include  <vector>
#include <cstring>
#define _ ios::sync_with_stdio(0);

using namespace std;
typedef pair< int, int > ii;
typedef pair<int, ii> pii;
int fg[100005], ts[100005] , n, m, aux[100005];

int main()
{_
    vector<int> v;
    cin>>n>>m;

    for(int i =1; i<=n; ++i)
    {
        cin>>ts[i];
    }
    aux[n]=1;
    for(int i =n-1; i>=1; --i)
    {
        if(!fg[ts[i]])
            aux[i] = aux[i+1]+1;
        else aux[i] = aux[i+1];

        fg[ts[i]]=1;
    }
    while(m--)
    {
        cin>>n;
        cout<<aux[n]<<endl;
    }
}

// 1517687035890


#include <iostream>
using namespace std;

int main(){

	int n, m, k;

	cin >> n >> m;

	int a[n], b[n];

	for(int i = 0 ; i < n; i++){

		cin >> k;
		a[i] = k;

	}

	b[n-1] = 1;
	bool var;

	for (int i = n-2; i >= 0; --i)
	{
		var =  true;
		for (int j = i+1; j < n; ++j)
		{
			if(a[i] == a[j]){
				var = false;
				break;
			}
		}
		if(var){
			b[i] = b[i+1] + 1;
		}
		else{
			b[i] = b[i+1];
		}
	}

	/*for (int i = 0; i < n; ++i)
	{
		cout << b[i] << " ";
	}
	cout << endl;*/

	for(int i = 0; i < m; i++){
		cin >> k;
		cout << b[k-1] << endl;
	}

	return 0;
}
// 1522949357174


#include <bits/stdc++.h>
using namespace std;
bool registro[1000001]={0};

int main(){
	int n, m;
	cin >> n >> m;

	int a[n], I[m], r[n];

	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < m; i++)
		cin >> I[i];

	r[n-1] = 1;
	registro[a[n]] = 1
	for(int i = n - 2; i >= 0; i--){
			if(registro[a[i]])
				r[i] = r[i + 1];
			else{
				r[i] = (r[i+1] + 1);
				registro[a[i]] = 1;
			}
	}

	for(int i = 0; i < m; i++){
		int p = I[i] - 1;
		cout << r[p] << endl;
	}
}

// 1523482757397


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n,m;
	cin >> n;
	cin >> m;
	vector<int> datos(n);
	for (int i=0;i<n;i++){
		cin >> datos[i];
	}
	vector<int> pos(m);
	for (int j=0;j<m;j++){
		cin >> pos[m];
	}
	set<int> s;
	vector<int> dp(m);
	for(int i=m-1;i>-1;i--){
		for(int h=i;h<n;h++){
			s.insert(datos[h]);
		}
		dp[i]=s.size();
	}
	for (int i=0;i<m;i++){
		cout << dp[i] << "\n";
	}
	return 0;
}
// 1523065016571


#include<iostream>
#include<set>
#include<stdio.h>
using namespace std;
int main(){

	int n,m;
	scanf("%d %d",&n,&m);
	set<int> si;
	int v[2][n];
	for(int i=0;i<n;i++){
		scanf("%d",&v[0][i]);
	}

	for(int i=n-1;i>=0;i--){
		si.insert(v[0][i]);
		v[1][i]=(int)si.size();
	}
	int x;
	while(m--){
		scanf("%d",&x);
		printf("%d\n",v[1][x-1]);
	}

}

// 1501881265159


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
  long long int n, m, count_dist;
  std::cin >> n;
  std::cin >> m;
  long long int esta [100010] = {0};
  long long int a [n];
  long long int count [n];

  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  count_dist = 0;
  for (int i = n-1; i >= 0; i--) {
    if (!esta[a[i]]) {
      std::cout << i  << '\n';
      count_dist++;
      count[i] = count_dist;
      esta[a[i]] = 1;
    }
    else {
      count[i] = count_dist;
    }
  }

  int aux;
  for (int i = 0; i < m; i++) {
    std::cin >> aux;
    std::cout << count[aux-1] << '\n';
  }
  return 0;
}

// 1523472851017


#include <iostream>

using namespace std;

int main()
{
    int n,m,v[100010],xd[100010],cont=0;
    bool aux[100010];
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        aux[v[i]]=0;
    }
    for(int i=n;i>0;i--)
    {
        if(!aux[v[i]])
        {
            cont++;
            aux[v[i]]=1;
        }
        xd[i]=cont;
    }
    for(int i=1;i<=m;i++)
    {
        cin>>n;
        cout<<xd[n]<<endl;
    }
    return 0;
}

// 1517705697827


#include <bits/stdc++.h>
using namespace std;

int main(){

	long n,m, distintos;
	cin>>n;
	cin>>m;
	long indices1[n],indices2[m],vecinos[n];
	long numeros[100005];
	for (long i=0;i<n;++i){
		cin>>indices1[i];
	}
	for (long i=0;i<m;++i){
		cin>>indices2[i];
	}
	for (long i=0;i<100005;++i){
		numeros[i]=0;
	}
	for (long i=0;i<n;++i){
		vecinos[i]=0;
	}
	vecinos[n-1]=1;
	for (long i=n-1;i>0;--i){
        long x=indices1[i-1];
		if (numeros[x]==0){
                numeros[x]=1;
		vecinos[i-1]=1+vecinos[i];
		}
		else vecinos[i-1]=vecinos[i];

	}
	for (long i=0;i<m;i++){
        long t=indices2[i]-1;
		cout<<vecinos[t]<<endl;
	}
	return 0;
}
// 1523512972852


#include <iostream>
#include <algorithm>
#include  <vector>
#include <cstring>
#define _ ios::sync_with_stdio(0);

using namespace std;
typedef pair< int, int > ii;
typedef pair<int, ii> pii;
int fg[100005], ts[100005] , n, m, aux[100005], a;

int main()
{_
    vector<int> v;
    cin>>n>>m;

    for(int i =1; i<=n; ++i)
    {
        cin>>ts[i];
    }
    aux[n]=1;
    for(int i =n-1; i>=1; --i)
    {
        if(!fg[ts[i]])
            aux[i] = aux[i+1]+1;
        else aux[i] = aux[i+1];

        fg[ts[i]]=1;
    }
    for(int i =1; i<=m; ++i)
    {
        cin>>a;
        if(a<=n)
            cout<<aux[a]<<endl;
        else cout<<0<<endl;
    }
}

// 1517687451452


#include<bits/stdc++.h>

using namespace std;

#define rep( i, a, b ) for( int i = a; i < b; i++ )
#define pb push_back
#define all(a)  a.begin(), a.end()
#define debug(a) cout << #a << " = " << a << endl;

typedef long long int ll;
typedef pair<int,int> ii;
int n, m, a, v[500000], resp[500000];
int main(){

	while( cin >> n >> m ){
		rep( i, 0, n ){
			cin >> v[i];
		}
		set < int > st;
		for( int i = n-1; i >= 0; i-- ){
			st.insert( v[i] );
			resp[i] = st.size();
		}
		while( m-- ){
			cin >> a;
			a--;
			cout << resp[a] << endl;
		}
	}
}
// 1467397896507


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m, l;
  scanf("%d %d",&n,&m);
  int a[n], q[n];
  set<int> s;
  for(int i = 0; i < n; i++){
    scanf("%d",&a[i]);
  }
  for(int i = n-1; i >= 0; i--){
    s.insert(a[i]);
    q[i] = s.size();
  }
  for(int i = 0; i < m; i++){
    scanf("%d",&l);
    printf("%d\n",q[l-1]);
  }
  return 0;
}
// 1455753449125


#include <bits/stdc++.h>
using namespace std;
long long resp[100004];
int main() {
    long long n;
    long long q;
    cin >> n;
    cin >> q;
    int A[n+1];
    int B[n];
    for(int i=1;i<=n;i++){
        cin >> A[i];
    }
    for(int i=0;i<q;i++){
        cin >> B[i];
    }
    resp[n]=1;
    for(long long i=n-1;i>0;i--){
        int flag = 1;//Si no hay nadie igual debemos agregar 1
        for(long long k=i+1;k<=n;k++){
            if(A[k]==A[i]){
                flag=0;//Oops, hay alguien igual
            }
        }
        if(flag){
            resp[i]=resp[i+1]+1;
        }else{
            resp[i]=resp[i+1];
        }
    }
    for(int i=0;i<q;i++) {
        cout << resp[B[i]] << endl;
    }
    return 0;
}
// 1522886220054


#include <bits/stdc++.h>

using namespace std;

int pa[100011],ma[100011],na[100011];
int main() {
    int N,M,i,a,sum;
    cin >> N >> M;
    sum = 0;
    for(i = 1 ; i <= N; i++)
        cin >> na[i];

    for(i = N ; i >= 1 ; i--) {
        a = na[i];
        if(!ma[a]) {
            ma[a] = 1;
            sum++;
        }
        pa[i] = sum;
    }
    while(M--){
        cin >> a;
        cout << pa[a] << endl;
    }
    return 0;
}
// 1523200956282


#include<bits/stdc++.h>

using namespace std;

int main(){
	int n, m;

	cin >> n;
	cin >> m;

	int vals[100005] = {0};
	int dp[100005] = {0};
	bool v[100005];

	for(int i = 0; i < n; i++){
		cin >> vals[i];
	}

	for(int i = n - 1; i >= 0; i--){
		if(!v[vals[i]])
			dp[i]++;
		v[vals[i]] = true;
	}

	for(int i = n -1; i >=0; i--)
		dp[i] += dp[i + 1];

	int e;
	for(int i = 0; i < m; i++){
		cin >> e;
		cout << dp[e] << endl;
	}

	return 0;
}
// 1523488440425


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	int m;
	while (scanf("%d%d", &n, &m) == 2){
		int S[100000];
		int ans[100001] = { 0 };
		map<int, int> T;
		for (int i = 0; i < n; i++)
			scanf("%d", &S[i]);
		T.clear();
		for (int i = n - 1; i >= 0; i--){
			if (T[S[i]] == 0){
				ans[i] = ans[i + 1] + 1;
				T[S[i]] = 1;
			}
			else
				ans[i] = ans[i + 1];
		}
		for (int i = 0; i < m; i++){
			int x;
			scanf("%d", &x);
			printf("%d\n", ans[x - 1]);
		}
	}
	return 0;
}
// 1535933565111


#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i(a); i < (b); i++)

#define all(c) c.begin(), c.end()
#define SORT(c) sort(all(c))
#define UNIQUE(c) { SORT(c); (c).resize( unique(all(c))-c.begin() ); }
#define pb push_back
#define sz(c) ((int)(c.size()))
#define fst first
#define snd second
#define clr(x) memset(x, 0, sizeof x)
#define nulo(x) memset(x, -1, sizeof x)
#define debug(x) cout << #x << " = " << x << "\n";
#define debug2(x,y) cout << #x << " = " << x << "  " << #y << " = " << y << "\n";
#define debugV(v) { cout << #v<<"[] = "; rep(i,0,sz(v)) cout << v[i] << " "; cout << "\n"; }

typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<string,int> msi;
typedef map<string, string> mss;

int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};

int v[100010];
int a[100010];
int ans[100010];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++){
		scanf (" %d", &v[i]);
		a[v[i]] = 0;
		ans[i] = 0;
	}

	int cont = 0;
	for (int i = n ; i >= 1; i--)
	{
		if (a[v[i]] == 0) a[v[i]]=1, cont++;
		ans[i] = cont;
	}

	int l;
	while (m--){
		scanf ("%d", &l);
		cout << ans[l] << "\n";
	}

	return 0;
}
// 1467396022393


#include <bits/stdc++.h>
using namespace std;
bool registro[10000001] = {0};

int main(){
	int n, m;
	cin >> n >> m;

	int a[n], I[m], r[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < m; i++)
		cin >> I[i];

	r[n-1] = 1;
	for(int i = n - 2; i >= 0; i--){
			if(registro[a[i]])
				r[i] = r[i + 1];
			else{
				r[i] = (r[i+1] + 1);
				registro[a[i]] = 1;
			}
	}

	for(int i = 0; i < m; i++){
		int p = I[i] - 1;
		cout << r[p] << endl;
	}
}

// 1523473730931


#include<bits/stdc++.h>

//LIFE IS NOT A PROBLEM TO BE SOLVED

using namespace std;

#define rep(i,a,b) for(int i = int(a); i < int(b) ; i++)
#define reo(i,a,b) for(int i = int(a); i >= int(b) ; i--)
#define rei(i,a,b) for(int i = int(a); i < int(b) ; i=i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ALL(c) c.begin(), c.end()
#define SORT(c) sort(ALL(c))
#define UNIQUE(c) { SORT(c); (c).resize( unique(ALL(c))-c.begin() ); }

#define INF 0x3F3F3F3F
#define MAXV 100001

const double EPS = 1e-9;

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair < int, int > ii;
typedef pair < double, ii > iii;

int main()
{
	int n, m; cin >> n >> m;
	int vet[n];
	rep(i, 0, n)
		scanf("%d", &vet[i]);
	int out[n+1];
	memset(out, 0, sizeof(out));
	set <int> uso;
	reo(i, n-1, 0){
		out[i]=out[i+1];
		if(!uso.count(vet[i]))
			out[i]++;

			uso.insert(vet[i]);
	}
	int aux;
	rep(i, 0, m){
		scanf("%d", &aux);
		cout << out[aux-1] << endl;
	}

return 0;
}
// 1467423545035


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n;
	cin>>m;
	vector<int> indices1(n,0);
	vector<int> indices2(m,0);
	vector<int> vecinos(n,0);
	vector<long> numeros(100005,0);
	for (int i=0;i<n;++i){
		cin>>indices1[i];
	}
	for (int i=0;i<m;++i){
		cin>>indices2[i];
	}
	for (int i=0;i<100005;++i){
		numeros[i]=0;
	}
	for (int i=0;i<n;++i){
		vecinos[i]=0;
	}
	for (int i=n-1;i>=0;--i){
        int x=indices1[i];
		if (numeros[x]==0){
                for(int j=0;j<i+1;++j)
                    {vecinos[j]++;}
		}
		numeros[x]++;
	}
	for (int i=0;i<m;i++){
        int t=indices2[i]-1;
		cout<<vecinos[t]<<endl;
	}
	return 0;
}
// 1523503135325


#include<bits/stdc++.h>

using namespace std;
	int n,m;
	vector<int> A(100000);
	vector<int> M(100000);
	vector<int> E(100000);

int g(int x){
	if(x<m){

		for(int i=0;i<n;i++){
			if(A[i]==M[x]){
				return 0;
			}
		}
		return 1;
	}

	}

int f(int i){
		while(i<m){

			if(E[i]!=-1){
				return E[i];
			}
			if(i==m-1){
				return E[i]=g(i);
			}
			else{

				return E[i]=f(i+1)+g(i);
			}
		}

		return 0 ;
	}
int main(){
	cin>>n;
	cin>>m;

	for(int l=0;l<m;l++){
		E[l]=-1;
	}
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	for(int j=0;j<m;j++){
		cin>>M[j];
	}
	for (int k=0;k<m;k++){
		cout<<f(k)<<"\n";
	}

	return 0;
}
// 1523310849907


#include <iostream>
#include <algorithm>
#include  <vector>
#include <cstring>
#define _ ios::sync_with_stdio(0);

using namespace std;
typedef pair< int, int > ii;
typedef pair<int, ii> pii;
int fg[100005], ts[100005] , n, m, aux[100005];

int main()
{_
    vector<int> v;
    cin>>n>>m;

    for(int i =1; i<=n; ++i)
    {
        cin>>ts[i];
    }
    aux[n]=1;
    for(int i =n-1; i>=1; --i)
    {
        if(!fg[ts[i]])
            aux[i] = aux[i+1]+1;
        else aux[i] = aux[i+1];

        fg[ts[i]]=1;
    }
    while(m--)
    {
        cin>>n;
        cout<<aux[n]<<endl;
    }
}

// 1517687035773


#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, m;
	while(cin >> n >> m)
	{
		int a[n];
		for(int i = 0; i < n; ++i)
		{
			int value;
			cin >> value;
			a[i] = value;
		}

		int  solution[n];

		map<int,bool> different;
		for(int i = n - 1; i >= 0; i--)
		{
			different[a[i]] = true;
			solution[i] = different.size();
		}

		for(int i = 0; i < m; ++i)
		{
			int value;
			cin >> value;
			cout << solution[value - 1] << endl;
		}
	}
}
// 1523450244161


#include <bits/stdc++.h>
using namespace std;
long long resp[100004];
int main() {
    long long n;
    long long q;
    cin >> n;
    cin >> q;
    int A[n];
    int B[n];
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    for(int i=0;i<q;i++){
        cin >> B[i];
    }
    resp[n]=1;
    map<int,string> mapa;//Estructura tramposa
    for(long long i=n-1;i>=0;i--){
        mapa[A[i]]="asdf ponganme un 7";
        resp[i]=mapa.size();
    }
    for(int i=0;i<q;i++) {
        cout << resp[B[i]-1] << endl;
    }
    return 0;
}
// 1522888021288


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,l=0,ch,sch=0;
    cin >> n >> k;
    vector <pair<int,int> > a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(mp(ch,i));
        r[i]=n-i;
    }
    sort(a.begin(),a.end());
    for (int i=1;i<n;i++)
    {
        if (a[i].x==a[i-1].x)
            {

                //cout << a[i-1].y << endl;
                sch++;
                for(int j=0;j<=a[i-1].y;j++) {r[j]--; }

            }
    }
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,ch,sch=0;
    cin >> n >> k;
    vector <int> m(100001,0);
    vector <int> a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (int i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    //for (int i=0;i<n;i++) cout << r[i] << ' ';
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back

using namespace std;
int main(){
    int n,k,sch=0,ch;
    cin >> n >> k;
    vector <int> m(1000000,0);
    vector <int> a;
    long long b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (int i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <iostream>
#include <vector>
#define pb push_back

using namespace std;
int main()
{
    int a,b,vv,sch=0;
    cin >> a >> b;
    vector <int> fs,r,se;
    vector <int> m(100002,0);
    for (int i=0;i<a;i++)
    {
        cin >> vv;
        m[vv]=0;
        fs.pb(vv);
        r.pb(0);
    }
    for (int i=a-1;i>=0;i--)
    {
        if (m[fs[i]]==0)
        {
            m[fs[i]]=1;
            sch++;
        }
        r[i]=sch;

    }
    for (int i=0;i<b;i++)
    {
        cin >> vv;
        se.pb(r[vv-1]);
    }
    for (int i=0;i<b;i++) cout << se[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,l=0,ch,sch=0;
    cin >> n >> k;
    vector <pair<int,int> > a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(mp(ch,i));
        r[i]=n-i;
    }
    sort(a.begin(),a.end());
    for (int i=1;i<n;i++)
    {
        if (a[i].x==a[i-1].x)
            {
                for(int j=0;j<=a[i-1].y;j++) {r[j]--;if (r[j]<0) r[j]=0;}
            }
    }
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,l=0,ch,sch=0;
    cin >> n >> k;
    vector <pair<int,int> > a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(mp(ch,i));
        r[i]=n-i;
    }
    sort(a.begin(),a.end());
    for (int i=1;i<n;i++)
    {
        if (a[i].x==a[i-1].x)
            {
                for(int j=0;j<=a[i-1].y;j++) r[j]--;
            }
    }
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,ch,sch=0;
    cin >> n >> k;
    vector <int> m(1000000,1);
    vector <int> a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (int i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    //for (int i=0;i<n;i++) cout << r[i] << ' ';
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    long long n,k,ch,sch=0;
    cin >> n >> k;
    vector <long long> m(1000000,1);
    vector <long long> a;
    long long b[n],r[n];
    for (long long i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (long long i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    //for (int i=0;i<n;i++) cout << r[i] << ' ';
    for (long long i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (long long i=0;i<k;i++) cout << b[i] << endl;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;
int main(){
    int n,k,l=0,ch,sch=0;
    cin >> n >> k;
    vector <int> m(100000,0);
    vector <int> a;
    int b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (int i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    //for (int i=0;i<n;i++) cout << r[i] << ' ';
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <iostream>
#include <vector>
#define pb push_back

using namespace std;
int main(){
    int n,k,sch=0,ch;
    cin >> n >> k;
    vector <int> m(1000000,0);
    vector <int> a;
    long long b[n],r[n];
    for (int i=0;i<n;i++)
    {
        cin >> ch;
        a.pb(ch);
        m[ch]=0;
    }
    for (int i=n-1;i>-1;i--)
    {
        if (m[a[i]]==0)
        {
            m[a[i]]++;
            sch++;
        }
        r[i]=sch;
    }
    for (int i=0;i<k;i++)
    {
        cin >> b[i];
        b[i]=r[b[i]-1];
    }
    for (int i=0;i<k;i++) cout << b[i] << endl;
}


#include <cstdio>
#include <cstring>
#define MAX 10000 + 10

bool hash[MAX];
int dp[MAX];
int a[MAX];
int data[MAX];

int main()
{
    int n, m;

    scanf("%d%d",&n, &m);

    for ( int i = 0; i < n; i ++){
        scanf("%d", &a[i]);
    }
    for ( int i = 0; i < m; i ++){
        scanf("%d", &data[i]);
    }

    memset( hash, 0, sizeof(hash));
    memset( dp, 0, sizeof(dp));

    for ( int i = n - 1; i >= 0; i --){
        if ( ! hash[a[i] ]){
            hash[a[i] ] = ! hash[a[i] ];
            dp[i] = dp[i + 1] + 1;
        }
        else{
            dp[i] = dp[i + 1];
        }
    }

    for ( int i = 0; i < m; i ++){
        printf("%d\n", dp[data[i] - 1]);
    }

    return 0;
}


#include <cstdio>
#include <cstring>
#define MAX 10000 + 10

bool hash[MAX];
int dp[MAX];
int a[MAX];
int data[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d",&n, &m)){
        memset( a, 0, sizeof(a));
        memset( data, 0, sizeof(data));
        for ( int i = 0; i < n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 0; i < m; i ++){
            scanf("%d", &data[i]);
        }

        memset( hash, 0, sizeof(hash));
        memset( dp, 0, sizeof(dp));

        for ( int i = n - 1; i >= 0; i --){
            if ( ! hash[a[i] ]){
                hash[a[i] ] = ! hash[a[i] ];
                dp[i] = dp[i + 1] + 1;
            }
            else{
                dp[i] = dp[i + 1];
            }
        }

        for ( int i = 0; i < m; i ++){
            printf("%d\n", dp[data[i] - 1]);
        }
    }

    return 0;
}


#include <cstdio>
#include <cstring>

#define MAX 100000 + 10

int a[MAX], l[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d", &n, &m)){
        for ( int i = 1; i <= n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 1; i <= m; i ++){
            scanf("%d", &l[i]);
        }

        for ( int i = 1; i <= m; i ++){
            int ans = 0;
            int k = i;
            for ( int j = l[i]; j <= n; j ++){
                if ( a[j] != l[k ++]){
                    ans ++;
                }
            }
            printf("%d\n", ans);
        }
    }

    return 0;
}


#include <cstdio>
#include <set>
#define MAX 100000 + 10

using namespace std;

int a[MAX], b[MAX];
set<int> s;
int n, m;

int main()
{
    scanf("%d%d", &n, &m);

    for ( int i = 1; i <= n; i ++){
        scanf("%d", &a[i]);
    }

    for ( int i = n; i >= 1; i --){
        s.insert(a[i] );
        b[i] = s.size();
    }

    for ( int i = 0; i < m; i ++){
        int k;
        scanf("%d", &k);
        printf("%d\n", b[k]);
    }

    return 0;
}


#include <cstdio>
#include <cstring>
#define MAX 100000 + 10

bool hash[MAX];
int dp[MAX];
int a[MAX];
int data[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d",&n, &m)){
        memset( a, 0, sizeof(a));
        memset( data, 0, sizeof(data));
        for ( int i = 0; i < n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 0; i < m; i ++){
            scanf("%d", &data[i]);
        }

        memset( hash, 0, sizeof(hash));
        memset( dp, 0, sizeof(dp));

        for ( int i = n - 1; i >= 0; i --){
            if ( ! hash[a[i] ]){
                hash[a[i] ] = ! hash[a[i] ];
                dp[i] = dp[i + 1] + 1;
            }
            else{
                dp[i] = dp[i + 1];
            }
        }

        for ( int i = 0; i < m; i ++){
            printf("%d\n", dp[data[i] - 1]);
        }
    }

    return 0;
}


#include <cstdio>
#include <cstring>
#define MAX 10000 + 10

bool hash[MAX];
int dp[MAX];
int a[MAX];

int main()
{
    int n, m;

    scanf("%d%d",&n, &m);

    for ( int i = 0; i < n; i ++){
        scanf("%d", &a[i]);
    }

    memset( hash, 0, sizeof(hash));
    memset( dp, 0, sizeof(dp));

    for ( int i = n - 1; i >= 0; i --){
        if ( ! hash[a[i] ]){
            hash[a[i] ] = ! hash[a[i] ];
            dp[i] = dp[i + 1] + 1;
        }
        else{
            dp[i] = dp[i + 1];
        }
    }

    for ( int i = 0; i < m; i ++){
        int data;
        scanf("%d", &data);
        printf("%d", dp[data - 1]);
    }

    return 0;
}


#include <cstdio>
#include <cstring>

#define MAX 100000 + 10

int a[MAX], l[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d", &n, &m)){
        for ( int i = 1; i <= n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 1; i <= m; i ++){
            scanf("%d", &l[i]);
        }

        for ( int i = 1; i <= m; i ++){
            int ans = 0;
            int k = i;
            for ( int j = l[i]; j <= n; j ++){
                if ( a[j] != k ++){
                    ans ++;
                }
            }
            printf("%d\n", ans);
        }
    }

    return 0;
}


#include <cstdio>
#include <cstring>

#define MAX 100000 + 10

bool hash[MAX];
int a[MAX], l[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d", &n, &m)){
        for ( int i = 1; i <= n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 1; i <= m; i ++){
            scanf("%d", &l[i]);
        }

        for ( int i = 1; i <= m; i ++){
            memset( hash, 0, sizeof(hash));
            int ans = 0;

            for ( int j = l[i]; j <= n; j ++){
                if ( !hash[a[j] ]){
                    hash[a[j]] = ! hash[a[j]];
                    ans ++;
                }

//                printf("%d ", hash[a[j] ]);
            }

            printf("%d\n", ans);
        }
    }

    return 0;
}


#include <cstdio>
#include <cstring>

#define MAX 100000 + 10

int a[MAX], l[MAX];

int main()
{
    int n, m;

    while ( ~scanf("%d%d", &n, &m)){
        for ( int i = 1; i <= n; i ++){
            scanf("%d", &a[i]);
        }
        for ( int i = 1; i <= m; i ++){
            scanf("%d", &l[i]);
        }

        for ( int i = 1; i <= m; i ++){
            int ans = 0;
//            int k = i;
            for ( int j = l[i]; j <= n; j ++){
                if ( a[j] != j){
                    ans ++;
                }
            }
            printf("%d\n", ans);
        }
    }

    return 0;
}


#include <cstdio>
#include <set>
#define MAX 10000 + 10

using namespace std;

int a[MAX], b[MAX];
set<int> s;
int n, m;

int main()
{
    scanf("%d%d", &n, &m);

    for ( int i = 1; i <= n; i ++){
        scanf("%d", &a[i]);
    }

    for ( int i = n; i >= 1; i --){
        s.insert(a[i] );
        b[i] = s.size();
    }

    for ( int i = 0; i < m; i ++){
        int k;
        scanf("%d", &k);
        printf("%d\n", b[k]);
    }

    return 0;
}


//#define _CRT_DISABLE_PERFCRIT_LOCKS

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define forn(m,n) for (int i=m; i<n; i++)
#define form(k,m) for (int j=k; j<m; j++)
//#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

int main() { //opt
    int n, m, *a, l;
    cin >> n >> m;
    a = new int[n];
    int c[100001] = {0}, d[100001] = {0};
    forn(0,n) {
        cin >> a[i];
        c[a[i]]++;
    }
    forn(1,100001) if (c[i]) d[0]++;
    forn(1,n) {
        d[i] = d[i-1];
        c[a[i-1]]--;
        if (c[a[i-1]] == 0) d[i]--;
    }
    form(0,m) {
        cin >> l;
        cout << d[--l] << "\n";
    }
    return 0;
}


#define _CRT_DISABLE_PERFCRIT_LOCKS

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define forn(m,n) for (int i=m; i<n; i++)
#define form(k,m) for (int j=k; j<m; j++)
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

int main() { //opt
    int n, m, *a, l;
    cin >> n >> m;
    a = new int[n];
    static int c[10001], d[10001];
    forn(0,n) {
        cin >> a[i];
        c[a[i]]++;
    }
    forn(1,10001) if (c[i]) d[0]++;
    forn(1,n) {
        d[i] = d[i-1];
        c[a[i]]--;
        if (c[a[i]] == 0) d[i]--;
    }
    form(0,m) {
        cin >> l;
        cout << d[--l] << "\n";
    }
    return 0;
}