/******************************************
          Mobarak Hosen Shakil
        ICE, Islamic University
     ID: mhiceiuk(all), 29698(LOJ)
   E-mail: mhiceiuk @ (Gmail/Yahoo/FB)
 Blog: https://iuconvergent.wordpress.com
*******************************************/
 
#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(true);
    cin.tie(0);
    string line;
    while(getline(cin, line))
    {
        char n1[105], n2[105], sum[210];

        int i, k;
        for(i=0, k=0; line[i]!=','; i++)
            n1[k++]=line[i];
        n1[k]='\0';
        int len1=k;

        for(i=k+1, k=0; line[i]; i++)
            n2[k++]=line[i];
        n2[k]='\0';
        int len2=k;
        ///cout<<n1<<" "<<n2<<endl;
        int a=0, b=0, c=0, d=0;
        for(i=0, k=0; i<max(len1, len2); i++) {
            a=0, b=0;
            if(i<len1) a=n1[i]-'0';
            if(i<len2) b=n2[i]-'0';
            d=(a+b+c)%10;
            c=(a+b+c)/10;
            if(d==0 && k==0) continue;
            sum[k++]=d+'0';
        }
        if(c) sum[k++]=c+'0';
        sum[k]='\0';
        cout<<sum<<endl;
    }
    return 0;
}

Advertisements