#include<iostream>
#include<vector>
#include<string>
#define max(x,y) (x>y? x:y)
using namespace std;
const int BASE = 1e4;
const int WIDTH = 4;
#pragma warning(disable:4996)
struct BigInteger {
int flag = 1;
vector<int> s;
BigInteger(long long int num = 0) { *this = num; }
BigInteger operator=(long long int num) {
s.clear();
do {
s.push_back(num%BASE);
num /= BASE;
} while (num);
return *this;
}
BigInteger operator=(const string& str) {
s.clear();
int x, len = (str.length() - 1) / WIDTH + 1;
for (int i = 0; i < len; ++i) {