/*
TASK:iban
LANG:C++
*/
#include<iostream>
#include<list>
#include<string>
using namespace std;
int n,i,j,k,m,p;
string s;
list<int> l1,l2,l;
char a[36],ch;
void syb(list<int> l1,list<int> l2)
{
     int ost=0;
     while((!l1.empty()||!l2.empty()))
     {
                                      if(!l1.empty())
                                      {
                                                              l.push_front((l1.front()+l2.front()+ost)%10);
                                                              ost=(l1.front()+l2.front()+ost)/10;
                                                              l1.pop_front();
                                                              l2.pop_front();
                                      }
                                      else
                                      {
                                      l.push_front((l2.front()+ost)%10);
                                      ost=(l2.front()+ost)/10;
                                      l2.pop_front();
                                      }
     }
     if(ost)l.push_front(ost);
}
int main()
{
    cin>>s;
    n=s.size();
    a[10]='A';a[11]='B';a[12]='C';a[13]='D';a[14]='E';a[15]='F';a[16]='G';a[17]='H';a[18]='I';a[19]='J';a[20]='K';a[21]='L';a[22]='M';a[23]='N';a[25]='P';a[26]='Q';a[27]='R';a[28]='S';a[29]='T';a[30]='U';a[31]='V';a[32]='W';a[33]='X';a[34]='Y';a[35]='Z';
    for(i=0;i<n;i++)
    {
                    if(s[i]=='0')
                    {
                    l1.push_front(0);
                    l1.push_front(0);
                    }
                    else
                    if(s[i]=='O')
                    {
                    l1.push_front(0);
                    l1.push_front(0);
                    }
                    else
                    if(s[i]>='1'&&s[i]<='9')
                    {
                                        ch=s[i];
                                        p=(ch-'0');
                                        l1.push_front(0);
                                        l1.push_front(p);    
                    }
                    else
                    {
                        for(j=10;j<=35;j++)
                        {
                                           if(s[i]==a[j])
                                           {
                                           l1.push_front((j/10));
                                           l1.push_front((j%10));
                                           }
                        }
                    }
    }
    l2=l1;
    l2.push_front(0);
    syb(l1,l2);
    while(!l.empty())
    {
                      cout<<l.front();
                      l.pop_front();
    }
    cout<<"\n";
}
