#include <bits/stdc++.h>
using namespace std;
int res[1001] = {0};
void add(string str) {
int len = str.size();
int carry = 0;
int i;
for (i = 0; i < len; i++) {
// 本位和
res[1000 - i] = res[1000 - i] + str[len - 1 - i] - '0' + carry;
// 进位
carry = res[1000 - i] / 10;
// 本位最终结果
res[1000 - i] = res[1000 - i] % 10;
}
// 最高位可能存在进位
if (carry == 1) {
res[1000-i] += 1;
}
}
int main() {
string str;
while (cin >> str) {
if (str == "0") break;
else add(str);
}
bool flag = true;
int count = 0;
for (int i = 0; i < 1001; i++) {
// 过滤res中无用的0
if (flag && res[i] == 0) {
count++;
} else {
flag = false;
cout << res[i];
}
}
if (count == 1001) cout << 0;
}
// 64 位输出请用 printf("%lld")