#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#define MAXN 100010
using namespace std ;
short d[2][MAXN] , ans[MAXN] , T[MAXN];
struct node
{
int mun;
node * next ;
} ;
int mun[2] ,len , ok , b[2] , N ;
bool GetMun( node * & hand , node * & pre )
{
pre = new node ;
string a ;
int n , i , j , h = 1;
cin >> a ;
if( a == "P") return 1 ;
n = a.size() ;
mun[len] = n ;
if( a[0] == '-' )
i = 1 , b[len] = 1 , mun[len]--;
else i = 0 , b[len] = 0 ;
for( j = n - 1 ; j >= i ; j-- )
d[len][h++] = a[j] - '0' ;
for( ; i < n ;i++){
pre->mun = a[i] - '0' ;
pre->next = hand ;
hand = pre ;
if( i != n-1 )
pre = new node ;
}
pre = hand ;
len++ ;
return 0 ;
}
void GetSum1( node *& pre1 , node *& pre2 , node *&hand3 , node *&pre3 )
{
int c = 0 ;
node *s ;
if( mun[0] < mun[1]) {
s = pre1 ;
pre1 = pre2 ;
pre2 = s ;
}
if( mun[0] != mun[1] )
{
while( pre2 )
{
pre3 = new node ;
pre3->mun = pre1->mun + pre2->mun + c ;
c = pre3->mun / 10 ;
pre3->mun = pre3->mun % 10 ;
pre2 = pre2->next ;
pre1 = pre1->next ;
pre3 ->next = hand3 ;
hand3 = pre3 ;