#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if (n % 2 == 0)
{
int ogl = 0;
while (n != 0)
{
int c = n % 10;
ogl = ogl * 10 + c;
n /= 10;
}
cout << ogl;
}
else
{
int s = 0;
while (n != 0)
{
int c = n % 10;
s += c;
n /= 10;
}
cout << s;
}
return 0;
}