#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s;
    cin >> s;
    for (auto it = s.rbegin(); it != s.rend(); ++it) {
        char c = *it;
        if (c == '6' || c == '9') {
            c ^= '6' ^ '9';
        }
        cout << c;
    }
    cout << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mem(a,val) memset(a,(val),sizeof((a)))
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define decimal(n)  cout << fixed ; cout << setprecision((n));
#define mp make_pair
#define eb emplace_back
#define f first 
#define s second
#define all(v) v.begin(), v.end()
#define endl "\n"
#define lcm(m,n) (m)*((n)/__gcd((m),(n)))
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(ll (i)=1;(i)<(n);(i)++)
#define repa(i,n,a) for(ll (i)=(a);(i)<(n);(i)++)
#define repr(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define pll pair<ll,ll>
#define pii pair<int, int>
#define mll map<ll,ll>
#define vll vector<ll>
#define sz(x) (ll)x.size()
#define ub upper_bound
#define lb lower_bound
#define pcnt(x) __builtin_popcountll(x)
const long long N=10;
const long long NN=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}

inline long long int mul(long long int a,long long int b){return (a*1LL*b)%M;}
inline long long int add(long long int a,long long int b){return (a+b)%M;}
inline long long int sub(long long int a,long long int b){return ((a%M-b%M)+M)%M;}
inline ll mod(long long int x,long long int p = M) {return (x < 0?(x%p)+p:x%p);}

long long int power(long long int b,long long int e,long long int m)
{
	if(e==0LL) return 1LL;
	if(e&1LL) return ((b%m)*(power((b*b)%m,e/2,m)))%m;
	return power((b*b)%m,e/2,m);
}

long long int modInverse(long long int A,long long int m)
{
    return power(A,m-2,m);
}

long long int fac[N+1],invfac[N+1];
void init()
{
    fac[0]=1;
    invfac[0]=1;
    for(long long int i=1;i<N+1;i++)
    {
        fac[i]=mul(fac[i-1],i);
    }
     for(long long int i=1;i<N+1;i++)invfac[i]=mul(invfac[i-1],modInverse(i,M));
}
long long int nCr(long long int n, long long int r) 
{  
    if(n<r)return 0LL;
    if (r==0)return 1LL; 
    return mul(mul(fac[n],invfac[r]),invfac[n-r]);
}
void solve()
{
  //code begins from here//
  init();
  string s;
  cin>>s;
  ll o=0,x=0,q=0;
  rep(i,sz(s))
  {
    if(s[i]=='x')x++;
    else if(s[i]=='o')o++;
    else q++;
  }
  ll ans=0;
  if(o==4)
  {
    ans=fac[4];
  }
  else if(o==3)
  {
    ans=q*fac[4]+3*(24/2);
  }
  else if(o==2)
  {
    ans=((q*(q-1))/2)*24+q*3*(12)+2*(4)+(6);
  }
  else if(o==1)
  {
    ans=1+q*(2*(fac[4]/fac[3])+(fac[4]/4))+nCr(q,2)*3*(fac[4]/fac[2])+nCr(q,3)*fac[4];
  }
  else if(o==0)
  {
    if(q)ans=pow(q,4);
  }
  cout<<ans;
}

signed main()
{
FAST
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int testcase=1;
//cin>>testcase;
while(testcase--) solve();
return 0;
}
