#include<stdio.h>
int main()
{
    int long a,b,c=0,d[100],e=0,f=0,g=0,h=0,r=0,z=0,x=0;
    
    if(scanf("%ld",&a)!=1 || a<0)
    {
        printf("Invalid input");
        return 0;
    }
    b=a;
    while(b!=0)
    {
        r=b%10;
        d[c]=r;
        c++;
        b=b/10;
    }
    z=c;
    c=0;
    while(c!=z-1)
    {
        if(d[c]==d[c+1])
        {
            x++;
            c++;
        }
        else
        {
            break;
        }
    }
    if(x==z)
    {
        printf("Invalid input");
        return 0;
    }
    c=0
    while(c!=z)
    {
        if(d[c]%2==0)
        {
            e=e+d[c];
        }
        else
        {
            f=f+d[c];
        }
        c++;
    }
    while(e!=0)
    {
        r=e%10;
        g=g+r;
        e=e/10;
    }
    while(f!=0)
    {
        r=f%10;
        h=h+r;
        f=f/10;
    }
    printf("%ld %ld",g,h);
}