#include <iostream>

char t[80];
int comptimes=0;
int addtimes=0;
int subtimes=0;
int multimes=0;
int divtimes=0;
int exptimes=0;
int comma;
int pad;

char n[220000];
int precision;
int decpoint;
int const adda=0;
int const addb=10000;
int const addr=20000;
int const suba=30000;
int const subb=40000;
int const subr=50000;
int const mula=60000;
int const mulb=70000;
int const mulr=80000;
int const diva=90000;
int const divb=100000;
int const divr=110000;
int const expa=120000;
int const expb=130000;
int const expr=140000;
int const temp1=150000;
int const temp2=160000;
int const resu=170000;
int const mem=180000;
int const une=190000;
int const zed=200000;
int const isequel=101;
int const aisgreater=102;
int const bisgreater=103;

void zero(int a){
	for (int b=0; b<=precision; b++){n[a+b]=0;}
}

void one(int a){
	zero(a);
	n[a+decpoint]=1;
}

void two(int a){
	zero(a);
	n[a+decpoint]=2;
}

void move(int a, int b){
	int c;
	for (c=0; c<=precision; c++){n[b+c]=n[a+c];}
}

void m10(int a){
	int c;
	for (c=0; c<=precision; c++){n[a+c]=n[a+c+1];}
	n[a+precision]=0;
}

void d10(int a){
	int c;
	for (c=precision; c>0; c--){n[a+c]=n[a+c-1];}
	n[a+0]=0;
}

int compare(int a, int b){
	comptimes++;
	int r=isequel;
	int c=0;
	while (n[a+c] == n[b+c] && c <= precision+1){c++;}
	if (c <= precision){
		if (n[a+c] > n[b+c]){r=aisgreater;}else{r=bisgreater;}
	}
	return r;
}

void add(){
	addtimes++;
	int a;
	int c=0;
	zero(addr);
	for (a=precision; a>=0; a--){
		n[addr+a]=n[adda+a]+n[addb+a]+c;
		if (n[addr+a]>9){
			c=1;
			n[addr+a]=n[addr+a]-10;
		}else{
			c=0;
		}
	}
}

void sub(){
	subtimes++;
	int a;
	int c=0;
	zero(subr);
	for (a=precision; a>=0; a--){
		n[subr+a]=n[suba+a]-n[subb+a]-c;
		if (n[subr+a]<0){
			c=1;
			n[subr+a]=n[subr+a]+10;
		}else{
			c=0;
		}
	}
}

void mul(){
	multimes++;
	int a,b ;
	int c=0;
	zero(mulr);
	for (a=precision; a>=0; a--){
		zero(adda);		
		for (b=precision; b>=0; b--){
			if (a+b-decpoint>=0 && a+b-decpoint<=precision){
				n[adda+a+b-decpoint]=(n[mulb+a]*n[mula+b])+c;
				c=0;
				while (n[adda+a+b-decpoint]>9){
					n[adda+a+b-decpoint]=n[adda+a+b-decpoint]-10;
				    c++;
				}
			}
		}
		move(mulr,addb);
		add();
		move(addr,mulr);
	}
}

void div(){
	int dig=decpoint;
	int digv;
    if (compare(divb,zed)!=isequel){
		d10(diva);
		dig--;
		while (compare(diva,divb)!=bisgreater){
			m10(divb);
			dig--;
		}
		while (compare(diva,divb)==bisgreater){
			d10(divb);
			dig++;
		}
		zero(divr);
		while (dig<=precision){
			digv=0;
			move(diva,temp1);
			while (compare(diva,divb)!=bisgreater && digv<10){
				move(diva,suba);
				move(divb,subb);
				sub();
				move(subr,diva);
				digv++;
			}
			if (digv>9){digv=0;}
			n[divr+dig]=digv;
			d10(divb);
			dig++;
		}
	}else{
		std::cout <<"\n   division by zero fault   \n";
		two(divr);
	}
}

void exp(){
	char b[40000];
	int bin;
	int a;
	// express expb in binary
	for (a=0; a<40000; a++){b[a]='0';}
	one(temp1);
	bin=1;
	// find the binary progression that is higher than expb
	while (compare(temp1,expb)==bisgreater){
		bin++;
		move(temp1,adda);
		move(temp1,addb);
		add();
		move(addr,temp1);
	}
	// count backwards from bin and subtract each binary progresion from expb
	for (a=bin; a>0; a--){
		if (compare(temp1,expb)!=aisgreater){
			b[a]='1';
			move(expb,suba);
			move(temp1,subb);
			sub();
			move(subr,expb);
		}
		move(temp1,diva);
		two(divb);
		div();
		move(divr,temp1);
	}
	// square expa and multiply each 1 diget of the resulting b[] of bin digets
	// b[1] is ones  b[2] is twos  b[3] is fours
	one(expr);            // beginning result  = expa^0  this keeps only those squeres which b[] claim
	move(expa,temp1);     // expa is  = expa^1  this is squeared each iteration
	for (a=1; a<=bin; a++){
		if (b[a]=='1'){
			move(expr,mula);
			move(temp1,mulb);
			mul();
			move(mulr,expr);
		}
		move(temp1,mula);
		move(temp1,mulb);
		mul();
		move(mulr,temp1);
	}
}

// display and interface beyond this point

int intvalueT(int a){
	int b=0;
	int s=1;
	while (a<80 && (t[a]<'0' || t[a]>'9')){
		if (t[a]=='-'){s=-1;}
		a++;
	}
	while (a<80 && t[a]>='0' && t[a]<='9'){
		b=b*10+t[a]-'0';
		a++;
	}
	b=b*s;
	return b;
}

void display(int a){
	int f=0;
	int b=precision;
	int c,m;
	char p;
	while (n[a+f]==0 && f<=precision){f++;}
	while (n[a+b]==0 && b>=0){b--;}
	b++;
    if (f>decpoint){f=decpoint;}
	if (b<=decpoint){b=decpoint+1;}
	if (b>precision){b=precision;}
	if (pad!=0){
		m=pad-(decpoint-f)-((decpoint-f)/3);
		while (m>0){
			std::cout <<" ";
			m--;
		}
	}
	for (c=f; c<=b; c++){
		p=n[a+c]+'0';
		std::cout <<p;
		if (c==decpoint){std::cout <<".";}
		m=c;
		while (m<decpoint){m=m+3;}
		if (m==decpoint && c<decpoint && comma==1){std::cout <<",";}
	}
}

void valueT(int v, int b){
	int a=-1;
	int c=-1;
	int d=decpoint;
	int x=0;
	int e,f,decdisplacement;
	
	a=0;
	while (a<80){
		if ((t[a]=='e' || t[a]=='E') && t[a+1]=='-'){t[a]='>';t[a+1]=' ';}
		if ((t[a]=='e' || t[a]=='E') && t[a+1]=='+'){t[a]='<';t[a+1]=' ';}
		if (t[a]=='e' || t[a]=='E'){t[a]='<';}
		a++;
	}		
	
	a=-1;
	c=-1;
	zero(v);
	// set a first 1-9  c deciimal point  f last 0-9
	while (b<80 && x<=1){
		f=b;
		if (c==-1 && t[b]=='.'){c=b;}
		if (a==-1 && t[b]>='1' && t[b]<='9'){a=b;}
		if (t[b]>='1' && t[b]<='9'){
			n[v+d]=t[b]-'0';
			d++;
		}
		if (a>-1 && t[b]=='0'){
			n[v+d]=t[b]-'0';
			d++;
		}
		b++;
		if (a!=-1 && (t[b]>'9' || t[b]<'0') && t[b]!='.'){x=2;}
	}
	
	int ee=-1;
	if (t[b]=='<'){e=intvalueT(b);ee=0;}
	if (t[b]=='>'){e=(intvalueT(b)* -1);ee=0;}

	std::cout <<a<<" "<<c<<" "<<f<<" "<<e<<"\n";

	
	// a is the first #  c is the dec place  f is last #
	// a234c567f 1234.5678  .0001  a=1 c=0 
	if (a==-1){                // no number
		zero(v);
		decdisplacement=0;
	}else{

		if (ee==-1){e=0;}       // no exponet
		if (c==-1){            // no decimal
			decdisplacement=f-a+e;
		}else{
			if (c<a){
				decdisplacement=c-a+e;
			}else{
				decdisplacement=c-a-1+e;
			}
		}
		
	}

	while (decdisplacement<0){
		d10(v);
		decdisplacement++;
	}
	while (decdisplacement>0){
		m10(v);
		decdisplacement--;
	}
}

void expdisplay(int a){
	int f=0;
	int c,d;
	char p;
	while (n[a+f]==0 && f<=precision){f++;}
	if (f>precision){f=precision-1;}
	c=decpoint-f;
	for (d=f; d<=f+6; d++){
		if (d<=precision){
			p=n[a+d]+'0';
		    std::cout <<p;
		}
		if (d==f){std::cout <<".";}
	}
	std::cout <<"e" ;
	if (c>=0){std::cout <<"+";}
	std::cout <<c;
}

int main (int argc, char * const argv[]) {
 
    // your code

	return 0;
}