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
#include <algorithm>
#include <cstdio>
#include <string>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define PB push_back
#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) ((int)(c).size())
#define STR(n,x) char x[n]; scanf("%s", x)

int main() {
	STR(5001, a1);
	STR(5001, b1);
	string a = a1, b = b1;
	reverse(ALL(a));
	reverse(ALL(b));
	int n = max(SIZE(a), SIZE(b));
	string r;
	int c = 0;
	REP(i,n) {
		int d = c;
		if (i < SIZE(a)) d += a[i] - '0';
		if (i < SIZE(b)) d += b[i] - '0';
		c = d / 10;
		d %= 10;
		r.PB('0' + d);
	}
	if (c) r.PB('1');
	reverse(ALL(r));
	printf("%s\n", r.c_str());
}