#include <iostream>
#include <vector>
using namespace std;
vector<int> add (vector<int>& A, vector<int>& B) {
if (A.size() < B.size()) return add(B, A);
vector<int> C;
int carry = 0;
for (int i = 0; i < A.size(); ++ i) {
carry += A[i];
if (i < B.size()) carry += B[i];
C.push_back(carry % 10);
carry /= 10;
}
if (carry) C.push_back(carry);
return C;
}
vector<int> sub (vector<int>& A, vector<int>& B) {
vector<int> C;
int borrow = 0;
for (int i = 0; i < A.size(); ++ i) {
borrow = A[i] - borrow;
if (i < B.size()) borrow -= B[i];
C.push_back((borrow + 10) % 10);
borrow = borrow < 0 ? 1 : 0;
}
while (C.size() > 1 && C.back() == 0) C.pop_back();
return C;
}
vector<int> max (vector<int> A, vector<int> B) {
if (A.size() > B.size()) return A;
if (A.size() < B.size()) return B;
if (vector<int>(A.rbegin(), A.rend()) > vector<int>(B.rbegin(), B.rend())) return A;
return B;
}
int main () {
string a, b;
cin >> a >> b;
vector<int> A, B;
for (int i = a.size() - 1; i >= 0; -- i) A.push_back(a[i] - '0');
for (int i = b.size() - 1; i >= 0; -- i) B.push_back(b[i] - '0');
vector<int> C = add(A, B);
for (int i = C.size() - 1; i >= 0; -- i) printf("%d", C[i]);
return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> mul (vector<int>& A, int b) {
vector<int> C;
int carry = 0;
for (int i = 0; i < A.size() || carry != 0; ++ i) {
if (i < A.size()) carry += A[i] * b;
C.push_back(carry % 10);
carry /= 10;
}
return C;
}
vector<int> mul (vector<int>& A, vector<int>& B) {
vector<int> C(A.size() + B.size());
for (int i = 0; i < A.size(); ++ i)
for (int j = 0; j < B.size(); ++ j)
C[i + j] += A[i] * B[j];
for (int i = 0; i < C.size(); ++ i) {
C[i + 1] += C[i] / 10;
C[i] %= 10;
}
while (C.size() > 1 && C.back() == 0) C.pop_back();
return C;
}
vector<int> div (vector<int>& A, int b, int& r) {
vector<int> C;
r = 0;
for (int i = A.size() - 1; i >= 0; -- i) {
r = r * 10 + A[i];
C.push_back(r / b);
r %= b;
}
reverse(C.begin(), C.end());
while (C.size() > 1 && C.back() == 0) C.pop_back();
return C;
}
int main () {
string a;
int b, r;
cin >> a >> b;
vector<int> A;
for (int i = a.size() - 1; i >= 0; -- i) A.push_back(a[i] - '0');
vector<int> C = div(A, b, r);
for (int i = C.size() - 1; i >= 0; -- i) cout << C[i];
cout << endl << r << endl;
return 0;
}