#include <algorithm>
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <ctime>
#include <string>
#include <random>
#include <set>
#include <stack>
#include <map>
#include <fstream>

using namespace std;
#define ll long long
const int MOD = 1000000007;
const double PI = 3.14159265358979;
/*
#define cin in
#define cout out
ifstream in("input.txt");
ofstream out("output.txt");
/**/

pair<int, int> v[1234567];
double mnd,  mxd;

void f(pair<int, int> p, pair<int, int> t, int x, int y)
{
	p.first -= x;
	p.second -= y;
	t.first -= x;
	t.second -= y;
	if(p.second == t.second)
	{
		if(min(p.first, t.first) <= 0 && max(p.first, t.first) >= 0)
			mnd = min(1.*abs(p.second), mnd);
		return;
	}
	ll a = p.second - t.second;
	ll b = t.first - p.first;
	ll c = -a*p.first - b*p.second;
	ll d = -b*p.first + a*p.second;
	double yy = (-b*c/((double)a) + d) / ((b*b) / double(a) + a);
	double xx = (-b*yy-c) / a;
	if(p.first > t.first)
		swap(p,t);
	if(xx >= p.first && xx <= t.first && yy >= min(p.second, t.second) && yy <= max(p.second, t.second))
		mnd = min(mnd, xx*xx+yy*yy);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	ll x, y;
	cin >> x >> y;
	mnd = 1e18;
	for(int i = 0; i < n; ++i)
	{
		ll a, b;
		cin >> a >> b;
		v[i] = make_pair(a, b);
		a -= x;
		b -= y;
		ll d = a*a+b*b;
		mnd = min(mnd, d*1.);
		mxd = max(mxd, d*1.);
	}
	f(v[0], v[n - 1], x, y);
	for(int i = 1; i < n; ++i)
		f(v[i], v[i-1], x, y);
	cout.precision(12);
	cout << fixed << PI * (mxd - mnd);

 	return 0;
}

/*
3 0 0
1 1
-1 1
0 2

*/


#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <map>
#include <time.h>
#include <string>
#include <algorithm>
#include <queue>
#include <assert.h>
#include <math.h>
#include <complex>

#pragma warning(disable:4996)

using namespace std;

#define For(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(v) (v).begin(),(v).end()

typedef long long int ll;
typedef vector<ll> lll;
typedef complex<double> point;

const int INF=1e9;
const int mod=1e9+7;
const ll LONGINF=4e18;
const double eps=1e-4;
const double PI=3.1415926535897932384626433832795;

ll dist(pair<ll,ll> a,pair<ll,ll> b){
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}

double dist(pair<ll,ll> p,pair<ll,ll> a,pair<ll,ll> b){
    ll A,B,C;
    A=a.y-b.y;
    B=b.x-a.x;
    C=a.x*b.y-a.y*b.x;
    return abs(A*p.x+B*p.y+C)/sqrt((double)(A*A+B*B));
}

double scal(pair<ll,ll> a,pair<ll,ll> b){
    return a.x*b.x+a.y*b.y;
}

pair<ll,ll> operator-(pair<ll,ll> a,pair<ll,ll> b){
    return mp(a.x-b.x,a.y-b.y);
}

void solve(){
    int n;
    pair<ll,ll> P,p,pr,f;
    double mn=LONGINF,mx=0;
    scanf("%d%I64d%I64d",&n,&P.x,&P.y);
    For(i,n){
        scanf("%I64d%I64d",&p.x,&p.y);
        if(i==0){
            f=p;
        }
        else{
            if(scal(pr-p,pr-P)>0&&scal(p-pr,p-P)>0){
                mn=min(mn,dist(P,p,pr));
                mx=max(mx,dist(P,p,pr));
            }
        }
        mn=min(mn,sqrt((double)dist(p,P)));
        mx=max(mx,sqrt((double)dist(p,P)));
        pr=p;
    }
    if(scal(p-P,p-f)>0&&scal(f-P,f-p)>0){
        mn=min(mn,dist(P,p,f));
        mx=max(mx,dist(P,p,f));
    }
    printf("%.10lf",PI*(mx*mx-mn*mn));

}

int main(){
#pragma comment(linker,"/STACK:268435456")
#ifdef _DEBUG
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
#endif
    solve();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<ctime>
using namespace std;
#define PI acos(-1.0)
int a[105];
double x,y,tx[100005],ty[100005],vmin=1e8,vmax=0;
double  work(double x, double y, double x1, double y1, double x2, double y2){
    double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
    if (cross <= 0) return sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));

    double d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
    if (cross >= d2) return sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));

    double r = cross / d2;
    double px = x1 + (x2 - x1) * r;
    double py = y1 + (y2 - y1) * r;
    return sqrt((x - px) * (x - px) + (py - y) * (py - y));
}
int main(){
    int i,j,n,m;
    scanf("%d%lf%lf",&n,&x,&y);
    for(i=1;i<=n;i++){
        scanf("%lf%lf",&tx[i],&ty[i]);
        vmax=max(vmax,sqrt((tx[i]-x)*(tx[i]-x)+(ty[i]-y)*(ty[i]-y)));
        if(i>1) vmin=min(vmin,work(x,y,tx[i],ty[i],tx[i-1],ty[i-1]));
    }
    if(n==1) vmin=vmax;
    if(n>1) vmin=min(vmin,work(x,y,tx[1],ty[1],tx[n],ty[n]));
    printf("%.18lf\n",PI*(vmax*vmax-vmin*vmin));
    //system("pause");
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

struct po{
    long long x, y;
    long long len2() {
        return x * x + y * y;
    }
};

int n;
double pi =  3.14159265358979323846;
po p, q;
long long mn = 1000000000000000000, mx = 0;

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    cin >> n >> p.x >> p.y;
    for (int i = 0; i < n; i++) {
        cin >> q.x >> q.y;
        q.x = q.x - p.x;
        q.y = q.y - p.y;
        mn = min(mn, q.len2());
        mx = max(mx, q.len2());

    }
    mn = mx - mn;
    cout.precision(30);
    cout << double(mn) * pi;
}


#include <iostream>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

struct po{
    double x, y;
    double len2() {
        return x * x + y * y;
    }
    double len() {
        return sqrt(x * x + y * y);
    }
    po () {}
    po (double x, double y) {
        this->x = x;
        this->y = y;
    }
};

po operator -(po v1, po v2) {
    return po(v1.x - v2.x, v1.y - v2.y);
}

double operator %(po v1, po v2) {
    return (v1.x * v2.y - v1.y * v2.x);
}

double operator *(po v1, po v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

int n;
double pi =  3.14159265358979323846;
po p, q[100500];
double mn = 100000000000000, mx = 0;

double min_d(po v1, po v2) {
    if ((v1 - v2) * (v1 - p) >= 0 && (v2 - v1) * (v2 - p) >= 0) {
        return ((v1 - p) * (v2 - p) / (v1 - v2).len2()) * ((v1 - p) * (v2 - p));
    }
    else {
        return min((v1 - p).len2(), (v2 - p).len2());
    }
}

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    cin >> n >> p.x >> p.y;
    for (int i = 0; i < n; i++) {
        cin >> q[i].x >> q[i].y;
    }
    q[n] = q[0];
    for (int i = 0; i < n; i++) {
        mx = max(mx, (q[i] - p).len2());
        mn = min(min_d(q[i], q[i + 1]), mn);
    }
    mn = mx - mn;
    cout.precision(30);
    cout << double(mn) * pi;
}


#include <iostream>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

struct po{
    double x, y;
    double len2() {
        return x * x + y * y;
    }
    double len() {
        return sqrt(x * x + y * y);
    }
    po () {}
    po (double x, double y) {
        this->x = x;
        this->y = y;
    }
};

po operator -(po v1, po v2) {
    return po(v1.x - v2.x, v1.y - v2.y);
}

double operator %(po v1, po v2) {
    return fabs(v1.x * v2.y - v1.y * v2.x);
}

double operator *(po v1, po v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

int n;
double pi =  3.14159265358979323846;
po p, q[100500];
double mn = 100000000000000, mx = 0;

double min_d(po v1, po v2) {
    if ((v1 - v2) * (v1 - p) >= 0 && (v2 - v1) * (v2 - p) >= 0) {
        return ((v1 - p) % (v2 - p) / (v1 - v2).len2()) * ((v1 - p) % (v2 - p));
    }
    else {
        return min((v1 - p).len2(), (v2 - p).len2());
    }
}

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    cin >> n >> p.x >> p.y;
    for (int i = 0; i < n; i++) {
        cin >> q[i].x >> q[i].y;
    }
    q[n] = q[0];
    for (int i = 0; i < n; i++) {
        mx = max(mx, (q[i] - p).len2());
        //cout << min_d(q[i], q[i + 1]);
        mn = min(min_d(q[i], q[i + 1]), mn);
    }
    mn = mx - mn;
    cout.precision(30);
    cout << double(mn) * pi;
}


#include<iostream>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
#define mx 100005
#define ma(x,y) make_pair(x,y)
int n;
double x, y;
int main() {
	cin >> n >> x >> y;
	double mii = hypot((1<<20),(1<<20)), mxx = 0;
	while (n--) {
		double x1, y1;
		cin >> x1 >> y1;
		mii = min(mii, hypot(x - x1, y - y1));
		mxx = max(mxx, hypot(x - x1, y - y1));
	}
	printf("%.9lf\n", acos(-1)*mxx*mxx - acos(-1)*mii*mii);
}


#include<iostream>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
#define mx 100005
#define ma(x,y) make_pair(x,y)
int n;
double x, y;
int main() {
	cin >> n >> x >> y;
	double mii = hypot((1<<20),(1<<20)), mxx = 0;
	while (n--) {
		double x1, y1;
		cin >> x1 >> y1;
		mii = min(mii, hypot(x - x1, y - y1));
		mxx = max(mxx, hypot(x - x1, y - y1));
	}
	printf("%.9lf\n", acos(-1.0)*mxx*mxx - acos(-1.0)*mii*mii);
}


#include<iostream>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
#define mx 100005
#define ma(x,y) make_pair(x,y)
int n;
double x, y;
double X[mx], Y[mx];
double dis(int i, int j) {
	double A = x - X[i];
	double B = y - Y[i];
	double C = X[j] - X[i];
	double D = Y[j] - Y[i];

	double dot = A * C + B * D;
	double len_sq = C * C + D * D;
	double param = dot / len_sq;

	double xx, yy;

	if (param < 0 || (X[i] == X[j] && Y[i]==Y[j])) {
		xx = X[i];
		yy = Y[i];
	}
	else if (param > 1) {
		xx = X[j];
		yy = Y[j];
	}
	else {
		xx = X[i] + param * C;
		yy = Y[i] + param * D;
	}

	double dx =x - xx;
	double dy = y - yy;

	return sqrtf(dx * dx + dy * dy);
}
int main() {
	cin >> n >> x >> y;
	double mii = hypot((1<<20),(1<<20)), mxx = 0;
	for (int i = 0;i < n;++i) cin >> X[i] >> Y[i];
	for (int i = 0;i < n;++i) {

		mii = min(mii, hypot(x - X[i], y - Y[i]));
		mii = min(mii, dis(i, (i + 1) % n));
		mxx = max(mxx, hypot(x - X[i], y - Y[i]));
	}
	printf("%.9lf\n", acos(-1.0)*mxx*mxx - acos(-1.0)*mii*mii);
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1.0e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px - k * b + k * py) / (k * k + 1.0);
  double y = x * k + b;
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return sqr(x - px) + sqr(y - py);
  }
  else {
    return 1.0e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(40) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-8
using namespace std;
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (diffx == 0) {
    if (sign(a[i].second - py) * sign(a[i + 1].second - py) <= 0) {
      return fabs(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
  if (sign(a[i].first - x) * sign(a[i + 1].first - x) <= 0) {
    return fabs(k1 * (x - px));
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  for (int i = 0; i < n - 1; i++) {
    minDist = min(minDist, func(a, i, px, py));
  }
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return (1 + k1 * k1) * sqr(x - px);
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(40) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1.0e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return (1.0 + k1 * k1) * sqr(x - px);
  }
  else {
    return 1.0e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(40) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-8
using namespace std;
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return fabs(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
  /*
  if (i == 2) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
  */
  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return fabs(sqrt(1 + k1 * k1) * (x - px));
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    minDist = min(minDist, ret * ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1.0e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
  double y = x * k + b;
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return sqr(x - px) + sqr(y - py);
  }
  else {
    return 1.0e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(40) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
using namespace std;
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-8
using namespace std;
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (diffx == 0) {
    if (sign(a[i].second - py) * sign(a[i + 1].second - py) <= 0) {
      return fabs(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
  /*
  if (i == 2) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
  */
  if (sign(a[i].first - x) * sign(a[i + 1].first - x) <= 0) {
    return fabs(sqrt(1 + k1 * k1) * (x - px));
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    minDist = min(minDist, ret * ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return (1 + k1 * k1) * sqr(x - px);
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-12
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return (1 + k1 * k1) * sqr(x - px);
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(40) << (maxDist - minDist) * PI << endl;
  return 0;
}


#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#define PI 3.1415926535897932384
#define eps 1e-8
using namespace std;
#define sqr(x) ((x) * (x))
int sign(double x) {
  if (x > eps) {
    return 1;
  }
  if (x < -eps) {
    return -1;
  }
  return 0;
}
double func(vector<pair<double, double> > &a, int i, double px, double py) {
  double diffx = a[i + 1].first - a[i].first, diffy = a[i + 1].second - a[i].second;
  if (sign(diffx) == 0) {
    if (sign(a[i].second - py) * sign(py - a[i + 1].second) >= 0) {
      return sqr(a[i].first - px);
    }
    else {
      return 1e15;
    }
  }
  double k = diffy / diffx;
  double b = a[i].second - k * a[i].first;
  double k1 = -1.0 / k;
  double x = (px / k - b + py) / (k + 1.0 / k);
/*
  if (i == 0) {
    cout << k << endl;
    cout << b << endl;
    cout << x << endl;
  }
*/

  if (sign(a[i].first - x) * sign(x - a[i + 1].first) >= 0) {
    return (1 + k1 * k1) * sqr(x - px);
  }
  else {
    return 1e15;
  }
}
int main() {
  int n;
  double px, py;
  cin >> n >> px >> py;
  vector<pair<double, double> > a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  a[n] = a[0];
  double maxDist = 0.0, minDist = 1e15;
  for (int i = 0; i < n; i++) {
    double diffx = fabs(a[i].first - px), diffy = fabs(a[i].second - py);
    double dist = diffx * diffx + diffy * diffy;
    maxDist = max(maxDist, dist);
    minDist = min(minDist, dist);
  }
  //cout << maxDist << "\t" << minDist << endl;
  for (int i = 0; i < n; i++) {
    //cout << maxDist << "\t" << minDist << endl;
    double ret = func(a, i, px, py);
    //cout << "ret = " << ret << endl;
    minDist = min(minDist, ret);
  }
  //cout << maxDist << "\t" << minDist << endl;
  cout << fixed << setprecision(20) << (maxDist - minDist) * PI << endl;
  return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <cstdio>
#include <map>
#include <hash_map>
#include <string>
#include <iomanip>
#include <vector>
#include <memory.h>
#include <queue>
#include <set>
#include <stack>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <functional>
#include <bitset>
#pragma comment (linker, "/STACK:167177216")
using namespace std;
#define mems(A, val) memset(A, val, sizeof(A))
#define mp(a, b) make_pair(a, b)
#define all(B) (B).begin(), (B).end()
#define forn(it, from, to) for(int it = from; it < to; ++it)
#define forit (it, coll) for(auto it = coll.begin(); it != coll.end(); ++it)
const int MAX = 2147483647;
const int MAXN = 200100;
typedef long long LL;
#define M_PI       3.14159265358979323846

double dst(pair<double, double> &p1, pair<double, double> &p2){
    return sqrt((p1.first - p2.first) * (p1.first - p2.first) + (p1.second - p2.second) * (p1.second - p2.second));
}

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    //freopen("john.in", "r", stdin); freopen("john.out", "w", stdout);
#endif
    int n;
    pair<double, double> p;
    cin >> n >> p.first >> p.second;
    double mini = 1e100;
    double maxi = 0;
    vector<pair<double, double> > a(n);
    forn(i, 0, n){
        double x, y;
        cin >> x >> y;
        a[i] = mp(x, y);
        double dist = dst(p, mp(x, y));
        maxi = max(dist, maxi);
    }
    a.push_back(a[0]);
    forn(i, 0, a.size() - 1){
        double x0 = a[i].first;
        double x1 = a[i + 1].first;
        double y0 = a[i].second;
        double y1 = a[i + 1].second;
        double dist = abs(((y0 - y1)*p.first + (x1 - x0)*p.second + (x0*y1 - x1*y0)) / dst(a[i], a[i + 1]));
        double a1 = dst(p, a[i]);
        double b1 = dst(p, a[i + 1]);
        double c1 = dst(a[i], a[i + 1]);
        mini = min(mini, a1);
        mini = min(mini, b1);
        if (abs(sqrt(a1*a1 - dist * dist) + sqrt(b1*b1 - dist * dist) - c1) > 1e-6) continue;
        mini = min(mini, dist);
    }

    printf("%.15f", M_PI * maxi * maxi - M_PI * mini*mini);

    return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <string>
#include <cstdio>
#include <vector>
#include <deque>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define rep(i,m,n) for(int i=(m),_end=(n);i < _end;++i)
#define repe(i,m,n) for(int i=(m), _end =(n);i <= _end;++i)
typedef long long ll;
using namespace std;
#ifdef ONLINE_JUDGE
const bool testing = false;
#else
const bool testing = true;
#endif

void program() {
	int n;
	cin >> n;
	ll x, y;
	cin >> x >> y;
	ll min = 1000ll*1000ll*1000ll*1000ll;
	ll max = 0;
	for (int i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		ll c = (a - x)*(a - x) + (b - y)*(b - y);
		if (c < min)
			min = c;
		if (c > max)
			max = c;
	}
	double r = max - min;
	r *= 3.141592653589793238463;
	cout.precision(20);
	cout << r << endl;
}

int main(){
	if(!testing){ // set testing to false when submiting to codeforces
		program(); // write your program in 'program' function (its your new main !)
		return 0;
	}

	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3 0 0\n0 1\n-1 2\n1 2\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(1) => expected : \n");
	printf("12.566370614359172464\n");
	printf("test case(1) => founded  : \n");
	program();
	fin = fopen("in.txt", "w+");
	fprintf(fin, "4 1 -1\n0 0\n1 2\n2 0\n1 1\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(2) => expected : \n");
	printf("21.991148575128551812\n");
	printf("test case(2) => founded  : \n");
	program();

	return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <string>
#include <cstdio>
#include <vector>
#include <deque>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define rep(i,m,n) for(int i=(m),_end=(n);i < _end;++i)
#define repe(i,m,n) for(int i=(m), _end =(n);i <= _end;++i)
typedef long long ll;
using namespace std;
#ifdef ONLINE_JUDGE
const bool testing = false;
#else
const bool testing = true;
#endif

// source http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
double pDistance(double x, double y, double x1, double y1, double x2, double y2) {

	double A = x - x1;
	double B = y - y1;
	double C = x2 - x1;
	double D = y2 - y1;

	double dot = A * C + B * D;
	double len_sq = C * C + D * D;
	double param = -1;
	if (len_sq != 0) //in case of 0 length line
		param = dot / len_sq;

	double xx, yy;

	if (param < 0) {
		xx = x1;
		yy = y1;
	}
	else if (param > 1) {
		xx = x2;
		yy = y2;
	}
	else {
		xx = x1 + param * C;
		yy = y1 + param * D;
	}

	double dx = x - xx;
	double dy = y - yy;
	return dx * dx + dy * dy;
}

void program() {
	int n;
	cin >> n;
	double x, y;
	cin >> x >> y;
	double min = 10e14;
	double max = 0;

	double fa, fb, pa, pb;
	double a, b, c;
	cin >> fa >> fb;
	pa = fa;
	pb = fb;
	for (int i = 1; i < n; i++)
	{
		cin >> a >> b;
		c = pDistance(x, y, pa, pb, a, b);
		if (c < min)
			min = c;
		c = (x - a)*(x - a) + (y - b)*(y - b);
		if (c > max)
			max = c;
		pa = a;
		pb = b;
	}
	c = pDistance(x, y,fa, fb, a, b);
	if (c < min)
		min = c;
	c = (x - fa)*(x - fa) + (y - fb)*(y - fb);
	if (c > max)
		max = c;

	double r = max - min;
	r *= 3.141592653589793238463;
	cout.precision(20);
	cout << r << endl;
}

int main(){
	if (!testing){ // set testing to false when submiting to codeforces
		program(); // write your program in 'program' function (its your new main !)
		return 0;
	}

	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "4 0 0\n1 1\n-1 1\n-1 2\n1 2\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(1) => expected : \n");
	printf("12.566370614359172464\n");
	printf("test case(1) => founded  : \n");
	program();
	fin = fopen("in.txt", "w+");
	fprintf(fin, "4 1 -1\n0 0\n1 2\n2 0\n1 1\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(2) => expected : \n");
	printf("21.991148575128551812\n");
	printf("test case(2) => founded  : \n");
	program();

	return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <string>
#include <cstdio>
#include <vector>
#include <deque>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define rep(i,m,n) for(int i=(m),_end=(n);i < _end;++i)
#define repe(i,m,n) for(int i=(m), _end =(n);i <= _end;++i)
typedef long long ll;
using namespace std;
#ifdef ONLINE_JUDGE
const bool testing = false;
#else
const bool testing = true;
#endif

void program() {
	int n;
	cin >> n;
	ll x, y;
	cin >> x >> y;
	ll min = 1000ll*1000ll*1000ll*1000ll*10ll;
	ll max = 0;
	for (int i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		ll c = (a - x)*(a - x) + (b - y)*(b - y);
		if (c < min)
			min = c;
		if (c > max)
			max = c;
	}
	double r = max - min;
	r *= 3.141592653589793238463;
	cout.precision(20);
	cout << r << endl;
}

int main(){
	if(!testing){ // set testing to false when submiting to codeforces
		program(); // write your program in 'program' function (its your new main !)
		return 0;
	}

	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3 0 0\n0 1\n-1 2\n1 2\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(1) => expected : \n");
	printf("12.566370614359172464\n");
	printf("test case(1) => founded  : \n");
	program();
	fin = fopen("in.txt", "w+");
	fprintf(fin, "4 1 -1\n0 0\n1 2\n2 0\n1 1\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("test case(2) => expected : \n");
	printf("21.991148575128551812\n");
	printf("test case(2) => founded  : \n");
	program();

	return 0;
}


//#define MYDEBUG
#define _CRT_SECURE_NO_WARNINGS
#define TASK "feast"
#pragma comment(linker, "/STACK:134217728")
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <functional>
#include <cassert>
#include <random>
#include <bitset>

const int MOD = 1000000007;
const int INF = 1000000001;
const int MAXN = 17;
const double EPS = 1e-6;
const int HASH_POW = 31;
const double PI = acos(-1.0);

using namespace std;

void my_return(int code)
{
#ifdef MYDEBUG
	cout << "\nTime = " << fixed << setprecision(3) << double(clock()) / CLOCKS_PER_SEC << endl;
#endif
	exit(code);
}

int n;

struct pt
{
	double x, y;
} c, p[100010];

double dist(pt a, pt b)
{
	return sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));
}

double check(pt a, pt b, pt c, double k)
{
	pt x;
	x.x = a.x + k*(b.x - a.x);
	x.y = a.y + k*(b.y - a.y);
	return dist(x, c);
}

int main()
{
	cin.sync_with_stdio(0);
	cin.tie(0);
	mt19937 mt_rand(time(NULL));
#ifdef MYDEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	/*freopen(TASK".in", "rt", stdin);
	freopen(TASK".out", "wt", stdout);*/
	/*freopen("text_editor.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);*/
#endif

	scanf("%d %lf %lf", &n, &c.x, &c.y);
	for (int i = 0; i < n; ++i)
		scanf("%lf %lf", &p[i].x, &p[i].y);

	double mn = 1000000000.0, mx = -1.0;
	for (int i = 0; i < n; ++i)
		mx = max(mx, dist(p[i], c));
	for (int i = 0; i < n; ++i)
	{
		pt a = p[i], b = p[(i + 1) % n];
		double ll = 0.0, rr = 1.0;
		for (int iter = 0; iter < 100; ++iter)
		{
			double mid1 = ll + (rr - ll) / 3.0, mid2 = rr - (rr - ll) / 3.0;
			if (check(a, b, c, mid1) > check(a, b, c, mid2))
				ll = mid1;
			else
				rr = mid2;
		}
		mn = min(mn, check(a, b, c, (ll + rr) / 2.0));
	}
	printf("%.7lf\n", PI*(mx*mx - mn*mn));

	my_return(0);
}


#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10e20
#define MIN -10e20
int n;
void solve()
{
	double PI = asin(1.0) * 2.0;
	int i;
	double nMin = MAX, nMax = MIN;
	double px, py, ax, ay, bx, by, fx, fy;
	scanf("%lf %lf", &px, &py);
	scanf("%lf %lf", &fx, &fy);
	ax = fx;
	ay = fy;
	double d1, d2, d, pa, pb, ab, s, r;
	for (i = 1; i < n; i++) {
		scanf("%lf %lf", &bx, &by);
		d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
		d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
		pb = (px - bx) * (px - bx) + (py - by) * (py - by);
		pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
		ab = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
		pb = sqrt(pb);
		pa = sqrt(pa);
		ab = sqrt(ab);
		if (d1 * d2 > 0 && d1 < d2) {
			r = (pa + pb + ab) / 2.0;
			s = r * (r - pa) * (r - pb) * (r - ab) * 4;
			d = s / ab / ab;
		}
		else if (d1 * d2 >= 1) {
			//PB
			d = pb * pb;
		}
		else {
			//PA
			d = pa * pa;
		}
		if (pb * pb > nMax) {
			nMax = pb * pb;
		}
		if (d < nMin) {
			nMin = d;
		}
		ax = bx;
		ay = by;
	}
	bx = fx;
	by = fy;
	d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
	d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
	pb = (px - bx) * (px - bx) + (py - by) * (py - by);
	pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
	ab = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
	pb = sqrt(pb);
	pa = sqrt(pa);
	ab = sqrt(ab);
	if (d1 * d2 > 0 && d1 < d2) {
		r = (pa + pb + ab) / 2.0;
		s = r * (r - pa) * (r - pb) * (r - ab) * 4;
		d = s / ab / ab;
	}
	else if (d1 * d2 >= 1) {
		//PB
		d = pb * pb;
	}
	else {
		//PA
		d = pa * pa;
	}
	if (pb * pb > nMax) {
		nMax = pb * pb;
	}
	if (d < nMin) {
		nMin = d;
	}
	d = (nMax - nMin) * PI;
	printf("%.10lf\n", d);
}
int main()
{
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;
int n, px, py;
#define MIN -10e9
#define MAX 10e9
void solve()
{
	double pi = 2.0 * asin(1.0);
	int i, x, y;
	double d;
	scanf("%d %d", &px, &py);
	double a = MIN, b = MAX;
	for (i = 0; i < n; i++) {
		scanf("%d %d", &x, &y);
		d = (double)(x - px) * (double)(x - px) + (double)(y - py) * (double)(y - py);
		if (d > a) {
			a = d;
		}
		if (d < b) {
			b = d;
		}
	}
	d = pi * (a - b);
	printf("%.12lf\n", d);
}
int main()
{
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10e9
#define MIN -10e9
int n;
void solve()
{
	double PI = asin(1.0) * 2.0;
	int i;
	double nMin = MAX, nMax = MIN;
	double px, py, ax, ay, bx, by, fx, fy;
	scanf("%lf %lf", &px, &py);
	scanf("%lf %lf", &fx, &fy);
	ax = fx;
	ay = fy;
	double d1, d2, d, pa, pb, ab, s, r;
	for (i = 1; i < n; i++) {
		scanf("%lf %lf", &bx, &by);
		d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
		d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
		pb = (px - bx) * (px - bx) + (py - by) * (py - by);
		pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
		ab = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
		pb = sqrt(pb);
		pa = sqrt(pa);
		ab = sqrt(ab);
		if (d1 * d2 > 0 && d1 < d2) {
			r = (pa + pb + ab) / 2.0;
			s = r * (r - pa) * (r - pb) * (r - ab) * 4;
			d = s / ab / ab;
		}
		else if (d1 * d2 >= 1) {
			//PB
			d = pb * pb;
		}
		else {
			//PA
			d = pa * pa;
		}
		if (pb * pb > nMax) {
			nMax = pb * pb;
		}
		if (d < nMin) {
			nMin = d;
		}
		ax = bx;
		ay = by;
	}
	bx = fx;
	by = fy;
	d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
	d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
	pb = (px - bx) * (px - bx) + (py - by) * (py - by);
	pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
	ab = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
	pb = sqrt(pb);
	pa = sqrt(pa);
	ab = sqrt(ab);
	if (d1 * d2 > 0 && d1 < d2) {
		r = (pa + pb + ab) / 2.0;
		s = r * (r - pa) * (r - pb) * (r - ab) * 4;
		d = s / ab / ab;
	}
	else if (d1 * d2 >= 1) {
		//PB
		d = pb * pb;
	}
	else {
		//PA
		d = pa * pa;
	}
	if (pb * pb > nMax) {
		nMax = pb * pb;
	}
	if (d < nMin) {
		nMin = d;
	}
	d = (nMax - nMin) * PI;
	printf("%.10lf\n", d);
}
int main()
{
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10e9
#define MIN -10e9
int n;
void solve()
{
	double PI = asin(1.0) * 2.0;
	int i;
	double nMin = MAX, nMax = MIN;
	double px, py, ax, ay, bx, by, fx, fy;
	scanf("%lf %lf", &px, &py);
	scanf("%lf %lf", &fx, &fy);
	ax = fx;
	ay = fy;
	double d1, d2, d, pa, pb;
	for (i = 1; i < n; i++) {
		scanf("%lf %lf", &bx, &by);
		d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
		d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
		pb = (px - bx) * (px - bx) + (py - by) * (py - by);
		pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
		if (d1 * d2 > 0 && d1 < d2) {
			d = d1 * d2 / d2;
		}
		else if (d1 * d2 >= 1) {
			//PB
			d = pb;
		}
		else {
			//PA
			d = pa;
		}
		if (pb > nMax) {
			nMax = pb;
		}
		if (d < nMin) {
			nMin = d;
		}
		ax = bx;
		ay = by;
	}
	bx = fx;
	by = fy;
	d1 = (px - ax) * (bx - ax) + (py - ay) * (by - ay);
	d2 = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
	pb = (px - bx) * (px - bx) + (py - by) * (py - by);
	pa = (px - ax) * (px - ax) + (py - ay) * (py - ay);
	if (d1 * d2 > 0 && d1 < d2) {
		d = d1 * d1 / d2;
	}
	else if (d1 * d2 >= 1) {
		//PB
		d = pb;
	}
	else {
		//PA
		d = pa;
	}
	if (pb > nMax) {
		nMax = pb;
	}
	if (d < nMin) {
		nMin = d;
	}
	d = (nMax - nMin) * PI;
	printf("%.10lf\n", d);
}
int main()
{
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


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

int main(){
	int n,i,p;
	string s;
	vector<string>a(n);
	cin>>s>>n;
	for(i=0;i<n;i++)cin>>a[i];
	sort(a.begin(),a.end());
	for(i=0;i<n;i++){
		if(s==a[i].substr(0,s.size())){
			cout<<a[i];
			return 0;
		}
	}
	cout<<s;
	return 0;
}


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

int main(){
	int n,i,p;
	string s;
	cin>>s>>n;
	vector<string>a(n);
	for(i=0;i<n;i++)cin>>a[i];
	sort(a.begin(),a.end());
	for(i=0;i<n;i++){
		if(s==a[i].substr(0,s.size())){
			cout<<a[i];
			return 0;
		}
	}
	cout<<s;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,st[105];
	int a,min=84836386;
	cin>>s>>a;
	bool f=1;
	for(int i=0;i<a;i++)
	{
		cin>>st[i];
		for(int j=0;j<s.size();j++)
		{
			if(s[j]!=st[i][j])
			{
				f=0;break;
			}
		}
		if(f==1)
		{
			cout<<st[i];
			return 0;
		}
	}
	cout<<s;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,st[105],str[105];
	int a;
	cin>>s>>a;
	bool f=1;
	int t=0;
	for(int i=0;i<a;i++)
	{
		cin>>st[i];
		for(int j=0;j<s.size();j++)
		{
			if(s[j]!=st[i][j])
			{
				f=0;break;
			}
		}
		if(f==1)
		{
			str[t]=st[i];
			t++;
		}
		f=1;
	}
	if(t==0)
	{
		cout<<s;
		return 0;
	}
	sort(str,str+t);
	cout<<str[0];
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,st[105];
	int a,min=84836386;
	cin>>s>>a;
	bool flag=1;
	for(int i=0;i<a;i++)
	{
		cin>>st[i];
		for(int j=0;j<s.size();j++)
		{
			if(st[i][j]!=s[j])
			{
				flag=0;break;
			}
		}
	}
	char minn;
	if(!flag)
	{
		cout<<s;
		return 0;
	}
	else
	{
		sort(st,st+a);
		cout<<st[0];
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,st[105],str[105];
	int a;
	cin>>s>>a;
	bool f=1;
	int t=0;
	for(int i=0;i<a;i++)
	{
		cin>>st[i];
		for(int j=0;j<s.size();j++)
		{
			if(s[j]!=st[i][j])
			{
				f=0;break;
			}
		}
		if(f==1)
		{
			str[t]=st[i];
			t++;
		}
	}
	if(t==0)
	{
		cout<<s;
		return 0;
	}
	sort(str,str+t);
	cout<<str[0];
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned char byte;
typedef pair<int,int>pri;
typedef pair<ll,ll>prl;
typedef vector<int>veci;
typedef vector<ll>vecl;
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define vec vector
#define binser binary_search
#define qsort sort
#define msort stable_sort
#define hsort heap_sort
#define $ '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define coutop(type, code) \
    ostream &operator << (ostream &out, const type &__##type) { \
        {code}\
        return out;\
    }
#define cinop(type, code) \
    istream &operator >> (istream &in, type &__##type) { \
        {code}\
        return in;\
    }
ll tableHash(const char*str,unsigned int len){static byte sTable[256];static
bool init=false;unsigned long long hash=0,i,rotate=2,seed=0x1A4E41U;if(!init){
init=true;srand(time(nullptr));for(i=0;i<256;i++)sTable[i]=rand()%256;}for(i=0;i
!=len;i++,str++){hash+=sTable[(*(const byte*)str+i)&255];hash=(hash<<(32-rotate)
)|(hash>>rotate);hash=(hash+i)*seed;}return(hash+len)*seed;}template<class T>T
gcd(T a,T b){while(a&&b)if(a>b)a%=b;else b%=a;return a+b;}template<class T>void
sortf(vector<T>&v){stable_sort(v.begin(),v.end());}template<class T>void sortb(
vector<T>&v){stable_sort(v.rbegin(),v.rend());}template<class T>T max3(T a,T b,
T c){return max(a,max(b,c));}template<class T>T min3(T a,T b,T c){return min(a,
min(b,c));}template<typename T>istream&operator>>(istream&in,vector<T>&v){for(T&
t:v)in>>t;return in;}ostream&operator<<(ostream&out,const vector<char>&v){for(
const char&t:v)out<<t;out<<endl;return out;}template<typename T>ostream&operator
<<(ostream&out,const vector<T>&v){for(const T&t:v)out<<t<<' ';out<<endl;return
out;}static void init_iostream_speed(){/*cin.tie(nullptr);cout.tie(nullptr);*/ios::
sync_with_stdio(false);}template<typename T>T lcm(T a,T b){return a*b/gcd(a,b);}
template<class T>void swap(T*a,T*b){T c=*a;*a=*b;*b=c;}template<typename T>class
vector2:public vector<T>{public:int min_ind(){return min_element(this->begin(),
this->end())-this->begin();}int max_ind(){return max_element(this->begin(),this
->end())-this->begin();}T min(){return*min_element(this->begin(),this->end());}T
max(){return*max_element(this->begin(),this->end());}void sortf(){::sortf(*this)
;}void sortb(){::sortb(*this);}vector2():vector<T>(){}vector2(vector<T>v):
vector<T>(v){}vector2(initializer_list<T>l):vector<T>(l){}vector2(size_t __n,
size_t __val=0):vector<T>(__n,__val){}};template<class T>T sum(vector<T>&vc){T
ans=0;for(T&v:vc)ans+=v;return ans;}string operator*(string s,int x){string a;
while(x--)a+=s;return a;}ll factorial(int x){ll a=1;for(int i=1;i<=x;i++)a*=i;
return a;}constexpr ld PI=3.1415926535897932384626433832795;int nextInt(){int t;
cin>>t;return t;}
//#define __VERY_HIGH_SPEED_ONLY_STDIO
//#define __OL_DEBUG
inline void __main_task();

int main() {
    #ifndef __VERY_HIGH_SPEED_ONLY_STDIO
    init_iostream_speed();
    #endif
    #ifndef __OL_DEBUG
    int t;cin>>t;while(t--)
    #endif
    #ifdef __OL_DEBUG
    for (;;) {
    #endif
    __main_task();
    #ifdef __OL_DEBUG
        cout << endl;
    }
    #endif
    return 0;
}

inline void __main_task() {
    string s, res, *n;
    int am;
    cin >> s >> am;
    n = new string[am];
    cin >> n[0];
    res = n[0];
    for (int i = 1; i < am; i++) {
        cin >> n[i];
        if (res > n[i] && n[i] >= s) res = n[i];
    }
    if (res.substr(0, s.length()) != s)
        cout << s << endl;
    else
        cout << res << endl;
    delete[] n;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned char byte;
typedef pair<int,int>pri;
typedef pair<ll,ll>prl;
typedef vector<int>veci;
typedef vector<ll>vecl;
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define vec vector
#define binser binary_search
#define qsort sort
#define msort stable_sort
#define hsort heap_sort
#define $ '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define coutop(type, code) \
    ostream &operator << (ostream &out, const type &__##type) { \
        {code}\
        return out;\
    }
#define cinop(type, code) \
    istream &operator >> (istream &in, type &__##type) { \
        {code}\
        return in;\
    }
ll tableHash(const char*str,unsigned int len){static byte sTable[256];static
bool init=false;unsigned long long hash=0,i,rotate=2,seed=0x1A4E41U;if(!init){
init=true;srand(time(nullptr));for(i=0;i<256;i++)sTable[i]=rand()%256;}for(i=0;i
!=len;i++,str++){hash+=sTable[(*(const byte*)str+i)&255];hash=(hash<<(32-rotate)
)|(hash>>rotate);hash=(hash+i)*seed;}return(hash+len)*seed;}template<class T>T
gcd(T a,T b){while(a&&b)if(a>b)a%=b;else b%=a;return a+b;}template<class T>void
sortf(vector<T>&v){stable_sort(v.begin(),v.end());}template<class T>void sortb(
vector<T>&v){stable_sort(v.rbegin(),v.rend());}template<class T>T max3(T a,T b,
T c){return max(a,max(b,c));}template<class T>T min3(T a,T b,T c){return min(a,
min(b,c));}template<typename T>istream&operator>>(istream&in,vector<T>&v){for(T&
t:v)in>>t;return in;}ostream&operator<<(ostream&out,const vector<char>&v){for(
const char&t:v)out<<t;out<<endl;return out;}template<typename T>ostream&operator
<<(ostream&out,const vector<T>&v){for(const T&t:v)out<<t<<' ';out<<endl;return
out;}static void init_iostream_speed(){/*cin.tie(nullptr);cout.tie(nullptr);*/ios::
sync_with_stdio(false);}template<typename T>T lcm(T a,T b){return a*b/gcd(a,b);}
template<class T>void swap(T*a,T*b){T c=*a;*a=*b;*b=c;}template<typename T>class
vector2:public vector<T>{public:int min_ind(){return min_element(this->begin(),
this->end())-this->begin();}int max_ind(){return max_element(this->begin(),this
->end())-this->begin();}T min(){return*min_element(this->begin(),this->end());}T
max(){return*max_element(this->begin(),this->end());}void sortf(){::sortf(*this)
;}void sortb(){::sortb(*this);}vector2():vector<T>(){}vector2(vector<T>v):
vector<T>(v){}vector2(initializer_list<T>l):vector<T>(l){}vector2(size_t __n,
size_t __val=0):vector<T>(__n,__val){}};template<class T>T sum(vector<T>&vc){T
ans=0;for(T&v:vc)ans+=v;return ans;}string operator*(string s,int x){string a;
while(x--)a+=s;return a;}ll factorial(int x){ll a=1;for(int i=1;i<=x;i++)a*=i;
return a;}constexpr ld PI=3.1415926535897932384626433832795;int nextInt(){int t;
cin>>t;return t;}
//#define __VERY_HIGH_SPEED_ONLY_STDIO
//#define __OL_DEBUG
inline void __main_task();

int main() {
    #ifndef __VERY_HIGH_SPEED_ONLY_STDIO
    init_iostream_speed();
    #endif
    #ifndef __OL_DEBUG
    //int t;cin>>t;while(t--)
    #endif
    #ifdef __OL_DEBUG
    for (;;) {
    #endif
    __main_task();
    #ifdef __OL_DEBUG
        cout << endl;
    }
    #endif
    return 0;
}

inline void __main_task() {
    string s, res, *n;
    int am;
    cin >> s >> am;
    n = new string[am];
    cin >> n[0];
    res = n[0];
    for (int i = 1; i < am; i++) {
        cin >> n[i];
        if (res > n[i] && n[i] >= s) res = n[i];
    }
    if (res.substr(0, s.length()) != s)
        cout << s << endl;
    else
        cout << res << endl;
    delete[] n;
}


//http://codeforces.com/contest/53/problem/A
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
string a[100];
int t,i;
int main()
{
    ios::sync_with_stdio(false);
    cin>>s;
    cin>>t;
    a[0]=s;
    i=0;
    while(t--)
    {
        string ss;
        cin>>ss;

        if(ss.substr(0,s.size())==s&&ss.size()>=s.size())
        {

            a[i]=ss;
            i++;
        }
        else
            continue;

    }
    sort(a,a+i);
    cout<<a[0]<<endl;
}


//http://codeforces.com/contest/53/problem/A
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
string a[100];
int t,i;
int main()
{
    ios::sync_with_stdio(false);
    cin>>s;
    cin>>t;
    a[0]=s;
    i=1;
    while(t--)
    {
        string ss;
        cin>>ss;

        if(ss.substr(0,s.size())==s&&ss.size()>=s.size())
        {

            a[i]=ss;
            i++;
        }
        else
            continue;

    }
    sort(a,a+i);
    cout<<a[0]<<endl;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main () /// Test Case 22 Wrong Answer
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len <= len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 1;
            }

        }

    }

    if(flag == 0)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        cout<<len<<" "<<len2<<endl;
        if(len < len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 1)
            {
                flag = 1;
            }
        }
        else if(t > 0)
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {
        cout<<"f"<<endl;
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len <= len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 0)
            {
                flag = 1;
            }
        }
        else if (t > 1 || t == n)
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len < len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 0)
            {
                flag = 1;
            }
        }
        else
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len < len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 1)
            {
                flag = 1;
            }
        }
        else if(t > 0)
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {

        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len < len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 0)
            {
                flag = 1;
            }
        }
        else if (t > 1 || t == n)
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main () /// Test Case 22 Wrong Answer
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len <= len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 1;
            }
            else if (t > 0)
            {
                flag = 0;
            }
        }

    }
    int sz = v.size();
    if(flag == 0 && sz != 0)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main () /// Test Case 22 Wrong Answer
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len <= len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 1;
            }
            else if (t > 0)
            {
                flag = 0;
            }
        }

    }
    if(flag == 0)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main ()
{
    string s1,s2,ss ;
    int t,len,len2,flag = 0;
    vector <string> v;

    cin>>s1>>t;
    int n = t ;
    len = s1.size();
    while(t--)
    {
        cin>>s2;
        ss = "";
        len2 = 0;
        len2 = s2.size();
        if(len <= len2)
        {
            ss = s2.substr(0, len);

            if(ss==s1)
            {
                v.push_back(s2);
                flag = 0;
            }
            else if (t > 0)
            {
                flag = 1;
            }
        }
        else if (t > 1 || n == 1)
        {
            flag = 1;
        }

    }
    if(flag == 1)
    {
        cout<<s1<<endl;
    }
    else
    {
        sort(v.begin(), v.end());
        cout<<v[0]<<endl;
    }
    return 0;
}


///***###                               بسم الله الرحمن الرحيم                            ###***///

/*
                    Author          : Borhan Uddin Rafi
                    University      : Begum Rokeya University,Rangpur.
                    Date            : 23 July,2020;
*/

///************************Start Of Template*************************///

#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#define Read_Fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(a) a.begin(),a.end()
#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define f1n(i,n) for(i=1;i<=n;i++)
#define szf sizeof()
#define sz size()
#define ln length()
#define mem(x,r) memset(x,r,sizeof(x))
#define inf 1000000000000
using namespace std;
using ll=long long;
const int N=500+4;

map<string,string>maap;

//////graph////////
vector<int>circle;
bool vis[N][N];
int parent[N];
int chk[N];
int color[N][N];
int tim[2][N];
int dis[N];
vector<int>adj[N*N];
vector<int>adj1[N*N];
//vector<pair<ll,ll>>adj[N];
vector<int>graph[N];
bool has_cycle;
int maxdis,maxnode,Totnode,depth=1;
bool ok;
queue<int>q;
stack<int>stk;
vector<int>solution;
int indegree[N];
int go[N];
int to[N];
pair<string,int>pa;
vector<string>vec;
string ss;
int nn;

//////graph////////

/*** this solution will not work if freopen  terminal are open................
    If you close that freopen then its work here.
    But before submission you need to open freopen line when submit .text file***/

////calculate the path //////

bool check(string ss, string str)
{
    for(int i=0;i<ss.size();i++)
    {
        if(i>=str.size() || ss[i]!=str[i])
        {
            return false;
        }
    }
    return true;
}

void solve()
{
    for(int i=0;i<nn;i++)
    {
        if(check(ss,vec[i]))
        {
            cout<<vec[i]<<endl;
            return ;
        }
    }
    cout<<ss<<endl;
}

//////////main function////////

int main()
{
    // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    Read_Fast;
    int t;
    // cin>>t;
    int cas=0;
    // while(t--)
    // {
    ll n,m,i,j,cnt1=0,cnt2=0,cnt=0,even=0,odd=0,len,k,r,l,z=0,x=0,y=0,flag=0,sum=0;
    ll a=0,b=0,c=0,d=0,ans=0,rem,quot,zero=0,fst=0,null=0,snd=0,lst=0,rone=0,one=0,pos=0,neg=0,mn=INT_MAX,mx=INT_MIN;

    char ch;

    ////Time/////
    int h1,h2,m1,m2,h;

    ////motion ////
    int velo1,velo2,ac1,ac2,time;

    /////Graph///
    int node,edge,u,v,cost;
    string str,str1,str2,strstore="";

    //////Input Node ////

    cin>>ss>>nn;
    for(int i=0;i<nn;i++)
    {
        cin>>str;
        vec.pb(str);
    }
    sort(all(vec));

    solve();

    //  }
    return 0;

///***###            ٱلْحَمْدُ لِلَّٰهِ          ###***///
}


///***###                               بسم الله الرحمن الرحيم                            ###***///

/*
                    Author          : Borhan Uddin Rafi
                    University      : Begum Rokeya University,Rangpur.
                    Date            : 23 July,2020;
*/

///************************Start Of Template*************************///

#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#define Read_Fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(a) a.begin(),a.end()
#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define f1n(i,n) for(i=1;i<=n;i++)
#define szf sizeof()
#define sz size()
#define ln length()
#define mem(x,r) memset(x,r,sizeof(x))
#define inf 1000000000000
using namespace std;
using ll=long long;
const int N=500+4;

map<string,string>maap;

//////graph////////
vector<int>circle;
bool vis[N][N];
int parent[N];
int chk[N];
int color[N][N];
int tim[2][N];
int dis[N];
vector<int>adj[N*N];
vector<int>adj1[N*N];
//vector<pair<ll,ll>>adj[N];
vector<int>graph[N];
bool has_cycle;
int maxdis,maxnode,Totnode,depth=1;
bool ok;
queue<int>q;
stack<int>stk;
vector<int>solution;
int indegree[N];
int go[N];
int to[N];
pair<string,int>pa;
vector<string>vec;
string ss;
int nn;

//////graph////////

/*** this solution will not work if freopen  terminal are open................
    If you close that freopen then its work here.
    But before submission you need to open freopen line when submit .text file***/

////calculate the path //////

bool check(string ss, string str)
{
    for(int i=0;i<ss.size();i++)
    {
        if(i>=str.size() || ss[i]!=str[i])
        {
            return false;
        }
    }
    return true;
}

void solve()
{
    for(int i=0;i<nn;i++)
    {
        if(check(ss,vec[i]))
        {
            cout<<vec[i]<<endl;
            return ;
        }
    }
    cout<<ss<<endl;
}

//////////main function////////

int main()
{
    // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    Read_Fast;
    int t;
    // cin>>t;
    int cas=0;
    // while(t--)
    // {
    ll n,m,i,j,cnt1=0,cnt2=0,cnt=0,even=0,odd=0,len,k,r,l,z=0,x=0,y=0,flag=0,sum=0;
    ll a=0,b=0,c=0,d=0,ans=0,rem,quot,zero=0,fst=0,null=0,snd=0,lst=0,rone=0,one=0,pos=0,neg=0,mn=INT_MAX,mx=INT_MIN;

    char ch;

    ////Time/////
    int h1,h2,m1,m2,h;

    ////motion ////
    int velo1,velo2,ac1,ac2,time;

    /////Graph///
    int node,edge,u,v,cost;
    string str,str1,str2,strstore="";

    //////Input Node ////

    cin>>ss>>nn;
    for(int i=0;i<nn;i++)
    {
        cin>>str;
        vec.pb(str);
    }
    sort(all(vec));

/*
    for(int i=0;i<nn;i++)
    {
        cout<<vec[i]<<endl;
    }

    */
    solve();

    //  }
    return 0;

///***###            ٱلْحَمْدُ لِلَّٰهِ          ###***///
}


#include<bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j;
    string s,result;
    cin>>s;
    //result=s;
    cin>>n;
    string s1[n],s2;
    for(i=0;i<n;i++){
        cin>>s1[i];
        if(s1[i].substr(0,s.size())==s){
            if(s1[i].size()==s.size())
            result=" ";
            else{
            s2=s1[i].substr(s.size(),s1[i].size()-s.size());
                if(result.empty())
                    result=s2;
                 else if(s2<result)
                result=s2;
        }
    }
    }
    cout<<s+result;
    return 0;
}


#include<bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j;
    string s,result;
    cin>>s;
    //result=s;
    cin>>n;
    string s1[n],s2;
    for(i=0;i<n;i++){
        cin>>s1[i];
        if(s1[i].substr(0,s.size())==s){
            if(s1[i].size()==s.size())
            result.push_back(' ');
            else{
            s2=s1[i].substr(s.size(),s1[i].size()-s.size());
            if(s2<result&&result.size()>1)
                result=s2;
                else if(result.size()==0)
                    result=s2;
        }
    }
    }
    cout<<s+result;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[600000];
int main()
{
    int n,i,j,k;
    string st,s[1000];
    cin>>st>>n;
    for(i=0; i<n; i++)
    {
        cin>>s[i];
    }
    sort(s,s+n);
    for(i=0; i<n; i++)
    {
        j = s[i].find(st);
        if(j!=-1)
        {
            if(j==0)
                cout<<s[i]<<endl;
            else
                cout<<st<<endl;
            return 0;
        }
    }
    cout<<st<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int a[600000];
int main()
{
    int n,i,j,k;
    string st,s[1000];
    cin>>st>>n;
    for(i=0; i<n; i++)
    {
        cin>>s[i];
    }
    sort(s,s+n);
    for(i=0; i<n; i++)
    {
        j = s[i].find(st);
        if(j!=-1)
        {
            if(j==0)
                cout<<s[i]<<endl;
            else
                cout<<st<<endl;
            return 0;
        }
    }
}


#include<iostream>
using namespace std;
int main()
{
	string a;
	int b,f=1;
	cin>>a>>b;
	string s,t;
	for(int i=0;i<b;i++)
	{
		cin>>s;
		if(s.substr(0,a.size())==a)
			if(f==1)
			{
				f=0;
				t=s;
			}
			else
				if(s<t)
					t=s;
	}
	if(f==0)
		cout<<t;
	else
		cout<<a;
}


#include<bits/stdc++.h>
using namespace std;
inline bool check(string b,string a)
{
    int len=a.length();
    int lenn=b.length();
    if(lenn<len)
    {
        return 0;
    }
    for(int i=0;i<len;i++)
    {
        if(a[i]!=b[i])
        {
            return 0;
        }
    }
    return 1;
}
int main()
{
    string s[1001],ans="";
    string st;
    int k;
    cin>>st;
    cin>>k;
    for(int i=1;i<=k;i++)
    {
        cin>>s[i];
    }
    for(int i=1;i<=k;i++)
    {
        if(check(s[i],st))
        {
            if(ans=="")
            {
                ans=s[i];
            }
            else
            {
                if(ans>s[i])
                {
                    ans=s[i];
                }
            }
        }
    }
    if(ans=="")
    {
        cout<<st<<endl;
        return 0;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
int n;
string st[110];
set<string> se;
set<string>::iterator it;
bool k;
int main() {
    cin>>s;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>st[i];
    for(int j=1;j<=n;j++) {
        k=false;
        for(int i=0;i<s.size();i++)
            if(s[i]!=st[j][i]) {
                k=true;break;
            }
        if(!k) se.insert(st[j]);
    }

    if(se.empty()) {
        cout<<s;
        exit(0);
    }
    it=se.begin();
    cout<<*it;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s,a[101];
int n;
int main()
{
	cin>>s;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	if(s==a[0].substr(0,s.size()))
	cout<<a[0]<<endl;
	else
	cout<<s<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
int n;
string st[110];
set<string> se;
set<string>::iterator it;
bool k;
int main() {
    cin>>s;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>st[i];
    //开始检查是否满足条件
    for(int j=1;j<=n;j++) {
        k=false;
        for(int i=0;i<s.size();i++)
            if(s[i]!=st[j][i]) {
                k=true;break;
            }
        //若满足条件则添加到set中
        if(!k) se.insert(st[j]);
    }
    //如果set中没有任何内容，就代表着没有符合条件的
    if(se.empty()) {
        cout<<s;
        exit(0);
    }
    //如果有，那么第一个就是答案（自动按照字典序排序）
    it=se.begin();
    cout<<*it;
    return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
char a[1000],b[1000],c[1000];
int s,d;
int main()
{
  scanf("%s%d",a,&s);
  d=strlen(a);
  while(s--)
  {
    scanf("%s",b);
    if(!strncmp(a,b,d))
    {
      if(!c[0])  strcpy(c,b);
      if(strcmp(b,c)<=0)  strcpy(c,b);
    }
  }
  if(c[0])  printf("%s",c);
  else  printf("%s",a);
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
priority_queue<string,vector<string>,greater<string> >q;
int main(){
	string s1;
	cin>>s1;
	int n;
	cin>>n;
	string s;
	for(int i=1;i<=n;i++){
	cin>>s;
	if (s.find(s1)==0)
	q.push(s);}
	string ans=q.top();
	cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;
string *a,m;
int n;
int main(){
    cin>>m>>n;
    a=new string[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n;i++)
        if(a[i].find(m)==0) {
            cout<<a[i]<<endl;
            return 0;
        }
    cout<<m<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int i,j,k,n;
	string *st,ss;
	cin>>ss>>n;
	st=new string[n];
	for(i=0;i<n;i++)cin>>st[i];
	sort(st,st+n);
	for(i=0;i<n;i++){
		if(st[i].find(ss)==0){
			cout<<st[i]<<endl;
			return 0;
		}
	}
	cout<<ss<<endl;
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,i,j,p;
string s,t,x;
int main(){
	cin>>s;
	cin>>n;
	t=s,p=1;
	for(i=1;i<=n;i++){
		cin>>x;
		bool c=0;
		for(j=0;j<s.length();j++)
			if(x[j]!=s[j]){
				c=1;
				break;
			}
		if(c==1)continue;
		if(p){p=0,t=x;continue;}
		c=0;
		for(j=0;j<min(t.length(),x.length());j++){
			if(t[j]>x[j]){
				t=x;
				c=1;
				break;
			}
			if(t[j]<x[j]){
				c=1;
				break;
			}
		}
		if(c==0)if(t.length()>x.length())t=x;
	}
	cout<<t<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a=0,b=0,c=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(x==1)a++;
		else if(x==2)b++;
		else if(x==3)c++;
	}
	cout<<a+b+c-max(max(a,b),c)<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int i,j,k,n;
	string *st,ss;
	cin>>ss>>n;
	st=new string[n+1];
	for(i=1;i<=n;i++)cin>>st[i];
	sort(st+1,st+n+1);
	for(i=1;i<=n;i++){
		if(st[i].find(ss)>=0){
			cout<<st[i]<<endl;
			return 0;
		}
	}
	cout<<ss<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s[1000],a;
int main()
{
	int n;
	cin>>a;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	sort(s,s+n);
	for(int i=0;i<n;i++)
	{
		if(s[i].substr(0,a.size())==a)
		{
		  cout<<s[i];
		  return 0;
	    }
	}
	cout<<a;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    string *str,var;
    int n;
    cin>>var>>n;
    str=new string[n];
    for(int i=0;i<n;i++)
        cin>>str[i];
    sort(str,str+n);
    for(int i=0;i<n;i++)
    {
        if(str[i].find(var)==0)
        {
            cout<<str[i]<<endl;
            return 0;
        }
    }
    cout<<var<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
int n;
string t[1000];
int main()
{
	cin>>s>>n;
	for(int i=1; i<=n; i++)
	  cin>>t[i];
	sort(t+1,t+n+1);
    for(int i=1; i<=n; i++)
    {
		int loc = t[i].find(s);
		if( loc==0 )
	      {cout<<t[i]<<endl; return 0;}
	}
	cout<<s<<endl;///
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	char a[101];
	cin>>a;
	int l;
	for(int i=0;i<101;i++){
		if(a[i]==0){
			l=i;
			break;
		}
	}
    int n;
    cin>>n;
    bool isfound=0;
    char b[101];
    char m[101];
    for(int i=0;i<n;i++){
    	cin>>b;
    	for(int j=0;j<l;j++){
    		if(b[j]!=a[j])break;
    		if(j==l-1){
				if(!isfound){
    				isfound=1;
    				for(int k=0;k<101;k++){
    					m[k]=b[k];
					}
				}else for(int k=0;k<101;k++){
    				if(m[k]<b[k])break;
    				if(m[k]>b[k]){
    					for(int l=0;l<101;l++){
    						m[l]=b[l];
						}
						break;
					}
				}
			}
		}
	}
	if(!isfound)cout<<a;
	else cout<<m;
}


#include<bits/stdc++.h>
using namespace std;
bool hehe(string s,string c)
{
	if(s.size()<c.size())
	return false;
	for(int i=0;i<c.size();i++)
	if(s[i]!=c[i])
	return false;
	return true;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string c;
	cin>>c;
	int a;
	cin>>a;
	string s;
	vector<string> v(a);
	for(int i=0;i<a;i++)
	{
		cin>>s;
		v[i]=s;
	}
	bool flag=false;
	sort(v.begin(),v.end());
	for(int i=0;i<a;i++)
	{
		if(hehe(v[i],c))
		{
			cout<<v[i];
			return 0;
		}
	}
	cout<<c;
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int i,j,k,n;
	string *st,ss;
	cin>>ss>>n;
	st=new string[n];
	for(i=1;i<=n;i++)cin>>st[i];
	sort(st+1,st+n+1);
	for(i=1;i<=n;i++){
		k=st[i].find(ss);
		if(k>=0){
			cout<<st[i]<<endl;
			return 0;
		}
		k=-1;
	}
	cout<<ss<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string *str,var;
int main(){
    int n;
    cin>>var>>n;
    str=new string[n];
    for(int i=0;i<n;i++)
        cin>>str[i];
    sort(str,str+n);
    for(int i=0;i<n;i++){
        if(str[i].find(var)==0){
            cout<<str[i]<<endl;
            return 0;
        }
    }
    cout<<var<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s,ans,t;
int main()
{
	int n;
	cin>>s;
	ans=s;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>t;
		if(s==t.substr(0,s.size()))
		{
			if(i==0)
				ans=t;
			else ans=min(ans,t);
		}
	}
	cout<<ans;
	return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n;
    string mins="zz";
    cin>>n;
    string a;
    int lens=s.length();
    bool flag=0;
    for(int i=0;i<n;i++){
        cin>>a;
        int lena=a.length();
        if(lena<lens){
            continue;
        }
        for(int i=0;i<lens;i++){
            if(s[i]!=a[i]){
                continue;
            }
        }
        flag=1;
        if(a<mins) mins=a;
    }
    if(!flag){
        cout<<s;
        return 0;
    }
    cout<<mins;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
string str_n[110];
set<string> str_pd;
set<string>::iterator ans;
bool pd;
int main()
{
	int n;
    cin>>s;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>str_n[i];
    for(int j=1;j<=n;j++)
	{
        pd=false;
        for(int i=0;i<s.size();i++)
            if(s[i]!=str_n[j][i])
			{
                pd=true;
				break;
            }
        if(!pd)
			str_pd.insert(str_n[j]);
    }
    if(str_pd.empty())
	 {
        cout<<s;
        exit(0);
    }
    ans=str_pd.begin();
    cout<<*ans;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int n;
	cin>>n;
	string b[n];
	for(int i=0;i<n;i++)
	cin>>b[i];
	sort(b,b+n);
	for(int j=0;j<n;j++)
	{
		int p=1;
	    for(int i=0;i<a.length();i++)
		{
			if(a[i]!=b[j][i])
			{
				p=0;
				break;
			}
		}
		if(p)
		{
			cout<<b[j]<<endl;
			return 0;
		}
	}
	cout<<a<<endl;
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;

string s;
int n;
string t[100];

int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> t[i];
    }

    sort(t, t + n);

    for(int i = 0; i < n; i++) {
        if (t[i].length() <= s.length()) {
            if (s == t[i].substr(0, s.length())) {
                cout << t[i];
                return 0;
            }
        }
    }
    cout << s;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;

string s;
int n;
string t[100];

int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> t[i];
    }

    sort(t, t + n);

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

        if (t[i].length() >= s.length()) {

            if (s == t[i].substr(0, s.length())) {
                cout << t[i];
                return 0;
            }
        }
    }
    cout << s;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;

string s;
int n;
string t[100];

int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> t[i];
    }

    sort(t, t + n);

    for(int i = 0; i < n; i++) {
        if (t[i].length() <= s.length()) {
            if (s == t.substr(0, s.length())) {
                cout << t[i];
                return 0;
            }
        }
    }
    cout << s;
    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n;
string s1[105];
vector<string>v;
int main() {
	string s;
	cin >> s >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s1[i];
		if (s1[i] == s) {
			cout << s << "\n";
			return 0;
		}
	}
	bool flag = 0;
	for (int j = 0; j < n; ++j) {
		for (int i = 0;i < s.size();++i) {
			if (s1[j][i] == s[i])
				flag = 1;
			else {
				flag = 0;
				break;
			}
		}
		if (flag)
			v.push_back(s1[j]);
	}
	if (v.empty()) { cout << s << endl; return 0; }
	sort(v.begin(), v.end());
	cout << v[0] << endl;
   return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n;
string s1[105];
vector<string>v;
int main() {
	string s;
	cin >> s >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s1[i];
		if (s1[i] == s) {
			cout << s << "\n";
			return 0;
		}
	}
	bool flag = 0;
	for (int j = 0; j < n; ++j) {
		for (int i = 0;i < s.size();++i) {
			if (s1[j][i] == s[i])
				flag = 1;
			else {
				flag = 0;
				break;
			}
		}
		if (flag)
			v.push_back(s1[j]);
	}
	if (!flag) { cout << s << endl; return 0; }
	sort(v.begin(), v.end());
	cout << v[0] << endl;
   return 0;
}


#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;

char s[101],lex[101],a[101];

int test(char str[])
{
    if(strlen(str)<strlen(s)) return 0;
    for(int i=0; i<strlen(s); i++)
    {
        if(str[i]!=s[i]) return 0;
    }
    return 1;
}

int main()
{
    int n,i,j=0;
    scanf("%s",s);
    scanf("%d",&n);

    for(i=0; i<n; i++)
    {
        scanf("%s",a);
        if(test(a)==0) continue;
        else
        {
            j++;
            if(j==1) strcpy(lex,a);
            else if(lexicographical_compare(a,a+ strlen(a),lex,lex+strlen(lex))) strcpy(lex,a);
        }
    }
    if(j) puts(lex);
    else puts(s);
    return 0;
}


/**     ************   *************   **************
        ************   *************   **************
        ***            ***       ***              ***
        ***            ***       ***              ***
        ************   *************              ***
        ************   *************              ***
                 ***   ***      ****              ***
                 ***   ***       ****   ***       ***
        ************   ***        ****  *************
        ************   ***         ****   ***********                                                                    */

#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctype.h>

using namespace std;

#define Forv(i,m)     for(i=0;i<m;i++)
#define Forc(j,p)     for(j=0;j<p;j++)
#define cin1(n)       scanf("%d",&n)
#define cin2(a,b)     scanf("%d%d",&a,&b)
#define cin3(a,b,c)   scanf("%d%d%d",&a,&b,&c)
#define cin4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define maxall(v) 	 *max_element(v.begin(),v.end())
#define minall(v) 	 *min_element(v.begin(),v.end())
#define pb            push_back
#define BE(a)         a.begin(),a.end()
#define rev(a)        reverse(BE(a));
#define sz(x) 			 ((int)(x).size())
#define sorta(a)      sort(BE(a))
#define mp            make_pair
#define LL            long long
#define fs            first
#define sc            second

template<class T> T gcd(T a, T b ) {return b<=0?a:gcd(b,a%b);}
template<class T> T lcm(T a, T b ) {return (a*b)/gcd(a,b);}
template<class T> T large(T a, T b ) {return a>b?a:b;}
template<class T> T small(T a, T b ) {return a<b?a:b;}
template<class T> T dif(T a, T b) {return a-b<0?b-a:a-b;}

int main(){
    vector<string>v;
    string s1,s2;
    int n,i,a,p,k,mn=9999999;
    cin>>s1;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>s2;
        p=s2.find(s1);
        if(p==0){
            v.push_back(s2);
        }
    }
    if(v.size()==0){
        cout<<s1<<endl;
    }
    else{
        //sort(v.begin(),v.end());
        for(i=0;i<v.size();i++){
            if(v[i].size()<mn){
                mn=v[i].size();
                k=i;
            }
        }
    cout<<v[k]<<endl;
    }

    return 0;
}


/**     ************   *************   **************
        ************   *************   **************
        ***            ***       ***              ***
        ***            ***       ***              ***
        ************   *************              ***
        ************   *************              ***
                 ***   ***      ****              ***
                 ***   ***       ****   ***       ***
        ************   ***        ****  *************
        ************   ***         ****   ***********                                                                    */

#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctype.h>

using namespace std;

#define Forv(i,m)     for(i=0;i<m;i++)
#define Forc(j,p)     for(j=0;j<p;j++)
#define cin1(n)       scanf("%d",&n)
#define cin2(a,b)     scanf("%d%d",&a,&b)
#define cin3(a,b,c)   scanf("%d%d%d",&a,&b,&c)
#define cin4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define maxall(v) 	 *max_element(v.begin(),v.end())
#define minall(v) 	 *min_element(v.begin(),v.end())
#define pb            push_back
#define BE(a)         a.begin(),a.end()
#define rev(a)        reverse(BE(a));
#define sz(x) 			 ((int)(x).size())
#define sorta(a)      sort(BE(a))
#define mp            make_pair
#define LL            long long
#define fs            first
#define sc            second

template<class T> T gcd(T a, T b ) {return b<=0?a:gcd(b,a%b);}
template<class T> T lcm(T a, T b ) {return (a*b)/gcd(a,b);}
template<class T> T large(T a, T b ) {return a>b?a:b;}
template<class T> T small(T a, T b ) {return a<b?a:b;}
template<class T> T dif(T a, T b) {return a-b<0?b-a:a-b;}

int main(){
	//freopen("in.txt","r",stdin);
	vector<string>v;
	string s1,s2;
	int n,i,p;
	cin>>s1;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s2;
		p=s2.find(s1);
		if(p==0){
			v.push_back(s2);
		}
	}
	if(v.size()==0){
		cout<<s1<<endl;
	}
	else{
		sort(v.begin(),v.end());
		cout<<v[0]<<endl;
	}

	return 0;
}


/**     ************   *************   **************
        ************   *************   **************
        ***            ***       ***              ***
        ***            ***       ***              ***
        ************   *************              ***
        ************   *************              ***
                 ***   ***      ****              ***
                 ***   ***       ****   ***       ***
        ************   ***        ****  *************
        ************   ***         ****   ***********                                                                    */

#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctype.h>

using namespace std;

#define Forv(i,m)     for(i=0;i<m;i++)
#define Forc(j,p)     for(j=0;j<p;j++)
#define cin1(n)       scanf("%d",&n)
#define cin2(a,b)     scanf("%d%d",&a,&b)
#define cin3(a,b,c)   scanf("%d%d%d",&a,&b,&c)
#define cin4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define maxall(v) 	 *max_element(v.begin(),v.end())
#define minall(v) 	 *min_element(v.begin(),v.end())
#define pb            push_back
#define BE(a)         a.begin(),a.end()
#define rev(a)        reverse(BE(a));
#define sz(x) 			 ((int)(x).size())
#define sorta(a)      sort(BE(a))
#define mp            make_pair
#define LL            long long
#define fs            first
#define sc            second

template<class T> T gcd(T a, T b ) {return b<=0?a:gcd(b,a%b);}
template<class T> T lcm(T a, T b ) {return (a*b)/gcd(a,b);}
template<class T> T large(T a, T b ) {return a>b?a:b;}
template<class T> T small(T a, T b ) {return a<b?a:b;}
template<class T> T dif(T a, T b) {return a-b<0?b-a:a-b;}

int main(){
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	map<string,LL int>m;
	string s1,s2,s3;
	LL int n,i,ck=0,mn=9999,t,p;
	cin>>s1;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s2;
		m[s2]=s2.find(s1);
		p=s2.find(s1);
		if(p==0){
			ck=1;
		}
	}
	if(ck!=1){
		cout<<s1<<endl;
	}
	else{
		for(auto it=m.begin();it!=m.end();it++){
			if(it->second==0){
				t=(*it).first.size();
				if(t<mn){
					mn=t;
					s3=it->first;
				}
			}
		}
		cout<<s3<<endl;
	}

	return 0;
}


/**     ************   *************   **************
        ************   *************   **************
        ***            ***       ***              ***
        ***            ***       ***              ***
        ************   *************              ***
        ************   *************              ***
                 ***   ***      ****              ***
                 ***   ***       ****   ***       ***
        ************   ***        ****  *************
        ************   ***         ****   ***********                                                                    */

#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctype.h>

using namespace std;

#define Forv(i,m)     for(i=0;i<m;i++)
#define Forc(j,p)     for(j=0;j<p;j++)
#define cin1(n)       scanf("%d",&n)
#define cin2(a,b)     scanf("%d%d",&a,&b)
#define cin3(a,b,c)   scanf("%d%d%d",&a,&b,&c)
#define cin4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define maxall(v) 	 *max_element(v.begin(),v.end())
#define minall(v) 	 *min_element(v.begin(),v.end())
#define pb            push_back
#define BE(a)         a.begin(),a.end()
#define rev(a)        reverse(BE(a));
#define sz(x) 			 ((int)(x).size())
#define sorta(a)      sort(BE(a))
#define mp            make_pair
#define LL            long long
#define fs            first
#define sc            second

template<class T> T gcd(T a, T b ) {return b<=0?a:gcd(b,a%b);}
template<class T> T lcm(T a, T b ) {return (a*b)/gcd(a,b);}
template<class T> T large(T a, T b ) {return a>b?a:b;}
template<class T> T small(T a, T b ) {return a<b?a:b;}
template<class T> T dif(T a, T b) {return a-b<0?b-a:a-b;}

int main(){
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	map<string,int>m;
	string s1,s2,s3;
	int n,i,ck=0,mn=9999,t,p;
	cin>>s1;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>s2;
		m[s2]=s2.find(s1);
		p=s2.find(s1);
		if(p==0){
			ck=1;
		}
	}
	if(ck!=1){
		cout<<s1<<endl;
	}
	else{
		for(auto it=m.begin();it!=m.end();it++){
			if(it->second==0){
				t=(*it).first.size();
				if(t<mn){
					mn=t;
					s3=it->first;
				}
			}
		}
		cout<<s3<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
int n;
string st[110];
set<string> se;
set<string>::iterator it;
bool k;
int main() {
    cin>>s;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>st[i];
    //开始检查是否满足条件
    for(int j=1;j<=n;j++) {
        k=false;
        for(int i=0;i<s.size();i++)
            if(s[i]!=st[j][i]) {
                k=true;break;
            }
        //若满足条件则添加到set中
        if(!k) se.insert(st[j]);
    }
    //如果set中没有任何内容，就代表着没有符合条件的
    if(se.empty()) {
        cout<<s;
        exit(0);
    }
    //如果有，那么第一个就是答案（自动按照字典序排序）
    it=se.begin();
    cout<<*it;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
string s,a[105];
int main() {
	ios::sync_with_stdio(false);
	cin >> s >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	sort(a + 1,a + n + 1);
	for(int i = 1; i <= n; i++)
		if(a[i].find(s) != -1) {
			cout << a[i];
			return 0;
		}
	cout << s;
	return 0;
}


#include <iostream>
#include <cstring>
#include <set>
using namespace std;

string s, a[105];

int n;

set <string> st;

int main()
{
    cin >> s >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        if(a[i].find(s) == 0)
        {
            st.insert(a[i]);
        }
    }
    if(st.empty())
    {
        cout << s << endl;
    }
    else
    {
        cout <<  *st.begin() << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str,a;
	int n;
	cin>>a>>n;
	str=new string[n];
	for(int i=0;i<n;i++)
	cin>>str[i];
	sort(str,str+n);
	for(int i=0;i<n;i++)
	{
		if(str[i].find(a)==0)
		{
			cout<<str[i]<<endl;
			return 0;
		}
	}
	cout<<a<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char a[1000],b[1000],c[1000];
int s,d;
int main(){
    scanf("%s%d",a,&s);
    d=strlen(a);
    while(s--){
        scanf("%s",b);
        if(!strncmp(a,b,d)){
            if(!c[0]) strcpy(c,b);
            if(strcmp(b,c)<=0) strcpy(c,b);
        }
    }
    if(c[0]) printf("%s",c);
    else printf("%s",a);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b,c;
    cin>>a;
    c=a;
    int n,p=1;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>b;
        int k=1;
        for(int j=0;j<a.size();j++){
            if(a[j]!=b[j]) k=0;
        }
        if(k){
            if(p) c=b,p=0;
            else{
                int kk=0;
                for(int j=0;j<min(c.size(),b.size());j++){
                    if(c[j]>b[j]){
                        c=b;
                        kk=1;
                        break;
                    }
                    if(c[j]<b[j]){
                        kk=1;
                        break;
                    }
                }
                if(kk==0){
                    if(c.size()>b.size()) c=b;
                }
            }
        }
    }
    cout<<c;
    return 0;
}


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

int main(){
	ios::sync_with_stdio(false);

	set<string> w;
	string s,tmp;
	int n;
	cin >> s >> n;
	w.insert(s);
	while(n--){
		cin >> tmp;
		if(tmp==s){
			cout << s;
			return 0;
		}
		if(tmp.substr(0,4)==s){
			w.insert(tmp);
		}
	}
	if(w.size()!=1){
		w.erase(w.begin());
		cout << *w.begin();
	}
    else cout << s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
inline bool check(string a,string b)
{
    int len=a.length();
    int lenn=n.length();
    if(lenn<len)
    {
        return 0;
    }
    for(int i=0;i<len;i++)
    {
        if(a[i]!=b[i])
        {
            return 0;
        }
    }
    return 1;
}
int main()
{
    string s[1001],ans="";
    string st;
    int k;
    cin>>st;
    cin>>k;
    for(int i=1;i<=k;i++)
    {
        cin>>s[i];
    }
    for(int i=1;i<=k;i++)
    {
        if(check(s[i],st))
        {
            if(ans=="")
            {
                ans=s[i];
            }
            else
            {
                if(ans>s[i])
                {
                    ans=s[i];
                }
            }
        }
    }
    if(ans=="")
    {
        cout<<st<<endl;
        return 0;
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
string ck,s[105];
int n;
int pd(string a,string b)
{
	int n = a.length();
	for (int i = 0; i < n; i++)
		{
			if (a[i] != b[i]) return 0;
		}
	return 1;
}
int main()
{
	cin >> ck >> n;
	for (int i = 1; i <= n; i++) cin >> s[i];
	sort(s + 1,s + 1 + n);
	for (int i = 1; i <= n; i++)
		{
			if (pd(ck,s[i]) == 1)
				{
					cout << s[i];
					return 0;
				}
		}
	cout << ck;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string *a,b;
    int n;
    cin>>b>>n;
    a=new string[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n;i++){
        if(a[i].find(b)==0){
            cout<<a[i]<<endl;
            return 0;
        }
    }
    cout<<b<<endl;
    return 0;
}