1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//2022-12-06
//author: Marcin Rolbiecki
#include <bits/stdc++.h>
using namespace std;

const int N = 5e3+10;

string sA, sB;
int A[N], B[N], ans[N];

int main () {
		
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> sA >> sB;
	for (int i = 1; i <= (int)sA.size(); i++)
		A[N-i] = sA[sA.size() - i]-'0';
	for (int i = 1; i <= (int)sB.size(); i++)
		B[N-i] = sB[sB.size() - i]-'0';
	
	for (int i = N-1; i > 0; i--) {
		
		ans[i] += A[i] + B[i];
		if (ans[i] > 9) {
			ans[i-1] += ans[i]/10;
			ans[i] %= 10;
		}
	}
	
	int i = 0;
	while (ans[i] == 0) i++;
	for (; i < N; i++)
		cout << ans[i];
	
	return 0;
}