#include<iostream>
#include<list>
#include<string>
#define Nm 0
#define nM 1
#define NM 2
using namespace std;

list<int> n, m, result;
int x = 0;
int nminus = 0, mminus = 1;

void inputN(){
    string N;
    cin >> N;
    if (N[0] == '-') nminus = 1;
    for(int i = nminus; i < N.length(); i++) {
        n.push_front(N[i] - '0');
    }
}

void inputM(){
    string M;
    cin >> M;
    if (M[0] == '-') mminus = 0;
    for(int i = 1 - mminus; i < M.length(); i++) {
        m.push_front(M[i] - '0');
    }
}

void computeplus(list<int> *n, list<int> *m) {
    if ((*n).empty() && (*m).empty()) {
        if(x == 0) return;
        else {
            result.push_front(1);
            return;
        }
    }
    if ((*n).empty()) {
        result.push_front((*((*m).begin()) + x) % 10);
        x = (*((*m).begin()) + x) / 10;
        (*m).pop_front();
        computeplus(n, m);
        return;
    }
    if ((*m).empty()) {
        result.push_front((*((*n).begin()) + x) % 10);
        x = (*((*n).begin()) + x) / 10;
        (*n).pop_front();
        computeplus(n, m);
        return;
    }
    result.push_front( ( *((*n).begin()) + *((*m).begin()) + x) % 10 );
    x = ( *((*n).begin()) + *((*m).begin()) + x) / 10;
    (*n).pop_front(); (*m).pop_front();
    computeplus(n, m);
    return;
}

int compare(list<int> n, list<int> m) {
    if( n.size() > m.size() ) return Nm;
    if( n.size() < m.size() ) return nM;
    list<int>::iterator itn = n.end();
    list<int>::iterator itm = m.end();
    for(; itn != n.begin();) {
        itn--; itm--;
        if(*itn == *itm) continue;
        if(*itn > *itm) return Nm;
        if(*itn < *itm) return nM;
    }
    return NM;
}

void computeminus(list<int> *n, list<int> *m) {
    if((*n).empty() && (*m).empty()) return;
    if((*m).empty()) {
        if (*((*n).begin()) - x >= 0) {
            result.push_front(*((*n).begin()) - x);
            x = 0; (*n).pop_front();
            computeminus(n, m);
            return;
        } else {
            result.push_front(*((*n).begin()) - x + 10);
            x = 1; (*n).pop_front();
            computeminus(n, m);
            return;
        }
    }
    if(*((*n).begin()) - *((*m).begin()) - x >= 0) {
        result.push_front(*((*n).begin()) - *((*m).begin()) - x);
        x = 0; (*n).pop_front(); (*m).pop_front();
        computeminus(n, m);
        return;
    } else {
        result.push_front(*((*n).begin()) - *((*m).begin()) - x + 10);
        x = 1; (*n).pop_front(); (*m).pop_front();
        computeminus(n, m);
        return;
    }
}

void eliminateO() {
    while(*(result.begin()) == 0) {
        result.pop_front();
    }
    return;
}

int main(void){
    inputN();
    inputM();
    if(nminus == 0 && mminus == 0) computeplus(&n, &m);
    if(nminus == 1 && mminus == 1) {
        computeplus(&n, &m);
        cout << "-";
    }
    if(nminus == 0 && mminus == 1) {
        if(compare(n, m) == NM) {
            cout << 0 << endl;
            return 0;
        }else if(compare(n, m) == Nm) {
            computeminus(&n, &m);
            eliminateO();
        }else if(compare(n, m) == nM) {
            computeminus(&m, &n);
            eliminateO();
            cout << "-";
        }
    }
    if(nminus == 1 && mminus == 0) {
        if(compare(n, m) == NM) {
            cout << 0 << endl;
            return 0;
        }else if (compare(n, m) == Nm) {
            computeminus(&n, &m);
            eliminateO();
            cout << "-";
        }else if (compare(n, m) == nM){
            computeminus(&m, &n);
            eliminateO();
        }
    }
    while(!(result.empty())){
        cout << *(result.begin());
        result.pop_front();
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 15716