/*
TASK:IBAN
LANG:C++
*/
//exod40:)
#include <cstdio>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

string t(char ch)
{
    string res;
    int k=ch-'A';
    
    k+=10;
    
    res=((k/10)+'0');
    res+=((k%10)+'0');
    
    return res;
}

string change(string old)
{
    string res;
    int n;
    int i;
    
    res="";
    
    n=old.size();
    
    for (i=0;i<n;i++)
    {
        if (isdigit(old[i]))
        {
            res+='0';
            res+=old[i];
        }
        else
        {
            if (old[i]=='O')
            {
                res+="00";
            }            
            else
            {
                res+=t(old[i]);                
            }
        }
    }    
    
    return res;
}

string sum(string s)
{
    string s2;
    string res;
    int i,j;
    int n;
    int ost;
    int fst,snd;
    
    s2='0';
    s2+=s;
    s+='0';
    
    res="";
    
    n=s2.size();
    
    ost=0;
    
    //printf ("%s\n%s\n",s.c_str(),s2.c_str());
    
    for (i=n-1;i>=0;i--)
    {
        fst=s[i]-'0';
        snd=s2[i]-'0';
        
        res+=((fst+snd+ost)%10)+'0';
        
        ost=(fst+snd+ost)/10;
    }    
    
    if (ost)
    {
        res+='1';
    }
    
    reverse (res.begin() , res.end());
    
    return res;
}

int main()
{
    string s;
    
    cin>>s;
    
    s=change(s);
    
    printf ("%s\n",sum(s).c_str());
}
