#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; const int Bit = ;
const int Max_N = ; struct BigNumber {
long long num[Max_N];
int len; BigNumber () {
len = ;
memset(num, , sizeof num);
} BigNumber (long long A) {
len = ;
while (A) {
num[++ len] = A % Bit;
A /= Bit;
}
} void Clear() {
len = ;
memset(num, , sizeof num);
} BigNumber operator = (const BigNumber &A) const {
BigNumber ret;
ret.len = A.len;
for (int i = ; i <= A.len; ++ i) {
ret.num[i] = A.num[i];
}
return ret;
} BigNumber operator + (const BigNumber &A) const {
BigNumber ret;
ret.len = max(A.len, len) + ;
for (int i = ; i <= len; ++ i) {
ret.num[i + ] += (A.num[i] + num[i]) / Bit;
ret.num[i] += (A.num[i] + num[i]) % Bit;
}
while (!ret.num[ret.len] && ret.len) -- ret.len;
return ret;
} BigNumber operator - (const BigNumber &A) const {
BigNumber ret = *this;
ret.len = max(len, A.len) + ;
for (int i = ; i <= A.len; ++ i) {
ret.num[i] -= A.num[i];
if (ret.num[i] < ) {
ret.num[i] += Bit;
ret.num[i + ] --;
}
}
while (!ret.num[ret.len] && ret.len) -- ret.len;
return ret;
} BigNumber operator * (const BigNumber &A) const {
BigNumber ret;
ret.len = len + A.len + ;
for (int i = ; i <= len; ++ i) {
for (int j = ; j <= A.len; ++ j) {
long long v = 1LL * num[i] * A.num[j] + ret.num[i + j - ];
ret.num[i + j] += v / Bit;
ret.num[i + j - ] += v % Bit;
}
}
while (!ret.num[ret.len] && ret.len) -- ret.len;
return ret;
} BigNumber operator / (const int &A) const {
BigNumber ret;
ret.len = len + ;
for (int i = ret.len; i > ; -- i) {
ret.num[i - ] = (ret.num[i] + num[i]) % A * Bit;
ret.num[i] = (ret.num[i] + num[i]) / A;
}
ret.num[] = ;
while (!ret.num[ret.len] && ret.len) -- ret.len;
return ret;
} void Read() {
Clear();
static char S[];
scanf("%s", S + );
int N = strlen(S + );
long long Pow = ;
for (int i = N; i; -- i) {
if (Pow == ) ++ len;
num[len] += (S[i] - '') * Pow;
Pow *= ;
if (Pow == Bit) Pow = ;
}
} void Write() {
printf("%lld", num[len]);
for (int i = len - ; i > ; -- i) {
printf("%09lld", num[i]);
}
}
} ; namespace WorkSpace {
void Main() {
BigNumber A;
A.Read();
long long B;
scanf("%lld", &B);
BigNumber(B).Write(); puts("");
(A * BigNumber(B)).Write();
return ;
}
} int main() {
WorkSpace :: Main();
return ;
}
by yjl
——QAQ%%%yjl