#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int Maxl = 105;
const int Lim = 10000;
const int Ten[4] = { 1, 10, 100, 1000 };
char tmp[Maxl];
struct bigint
{
	int len, s[Maxl];
	bigint()
	{
		len = 1; memset(s, 0, sizeof s);
	}
	void clean()
	{
		while(len > 1 && !s[len-1]) len--;
	}
	string str() const
	{
		string c = "";
		bool flag = 0; int x;
		for(int i = len-1; ~i; i--)
		{
			x = s[i];
			for(int k = 3; ~k; k--)
			{
				if(x/Ten[k]) flag = 1;
				if(!flag && !(x/Ten[k]))
					continue;
				c = c + (char)(x/Ten[k] + '0');
				x %= Ten[k];
			}
		}
		if(c == "") c = "0";
		return c;
	}
	bigint(const int num)
	{
		*this = num;
	}
	bigint(const char* num)
	{
		*this = num;
	}
	bigint operator = (const int num)
	{
		sprintf(tmp, "%d", num);
		*this = tmp;
		return *this;
	}
	bigint operator = (const char* num)
	{
		int sz = strlen(num), j, k;
		len = (sz+3) / 4; //ceil
		memset(s, 0, sizeof s);
		for(int i = sz-1; i >= 0; i--)
		{
			j = (sz-i-1) / 4;
			k = (sz-i-1) % 4;
			s[j] += Ten[k] * (num[i]-'0');
		}
		clean();
		return *this;
	}
	bool operator < (const bigint &b)const
	{
		if(len != b.len) return len < b.len;
		for(int i = len-1; i >= 0; i--)
			if(s[i] != b.s[i]) return s[i] < b.s[i];
		return 0;
	}
	bool operator <= (const bigint &b)const
	{
		return !(b < *this);
	}
	bool operator > (const bigint &b)const
	{
		return b < *this;
	}
	bool operator >= (const bigint &b)const
	{
		return !(*this < b);
	}
	bool operator == (const bigint &b)const
	{
		if(len != b.len) return 0;
		for(int i = 0; i < len; i++)
			if(s[i] != b.s[i]) return 0;
		return 1;
	}
	bigint operator + (const bigint &b)const
	{
		bigint c;
		c.len = max(len, b.len);
		int x = 0;
		for(int i = 0; i < c.len; i++)
		{
			x += s[i] + b.s[i];
			c.s[i] = x % Lim;
			x /= Lim;
		}
		while(x)
		{
			c.s[c.len++] = x % Lim;
			x /= Lim;
		}
		return c;
	}
	bigint operator - (const bigint &b)const //*this > b
	{
		bigint c; c.len = len;
		int x = 0;
		for(int i = 0; i < c.len; i++)
		{
			x += Lim + s[i] - b.s[i];
			c.s[i] = x % Lim;
			x = x / Lim - 1;
		}
		c.clean();
		return c;
	}
	bigint operator * (const bigint &b)
	{
		bigint c; c.len = len + b.len;
		int x;
		for(int i = 0; i < len; i++)
		{
			x = 0;
			for(int j = 0; j < b.len; j++)
			{
				x += s[i] * b.s[j] + c.s[i+j];
				c.s[i+j] = x % Lim;
				x /= Lim;
			}
			c.s[i+b.len] = x;
		}
		c.clean();
		return c;
	}
	bigint operator / (const int b)const
	{
		bigint c; c.len = len;
		LL x = 0;
		for(int i = c.len-1; ~i; i--)
		{
			x = x * Lim + s[i];
			c.s[i] = x / b;
			x %= b;
		}
		c.clean();
		return c;
	}
	bigint operator / (const bigint &b)const
	{
		bigint l, r, mid;
		l = 0, r = *this;
		while(l < r)
		{
			mid = (l + r) / 2;
			if(mid <= *this) l = mid;
			else if(mid > *this) r = mid - 1;
		}
		return l;
	}
};

istream& operator >> (istream &in, bigint &x)
{
	string c;
	in>>c;
	x=c.c_str();
	return in;
}

ostream& operator << (ostream &out, const bigint &x)
{
	out<<x.str();
	return out;
}

int main ()
{
    
}