#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	string s; cin >> s;
	reverse(s.begin(), s.end());

	for (char& c : s) {
		switch (c) {
		case '6':
			c = '9'; break;
		case '9': c = '6'; break;
		}
	}

	cout << s;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
using P=pair<ll,ll>;
int main() {
    string s;
    cin >> s;
    map<ll,ll>ok;
    for(ll i=0;i<10;i++){
        if(s[i]=='o') ok[i]++;
    }
    ll ans=0;
    for(ll i=0;i<10;i++){
        if(s[i]=='x') continue;
        for(ll j=0;j<10;j++){
            if(s[j]=='x') continue;
            for(ll k=0;k<10;k++){
                if(s[k]=='x') continue;
                for(ll l=0;l<10;l++){
                    if(s[l]=='x') continue;
                    map<ll,ll>copy=ok;
                    copy[i]--;
                    copy[j]--;
                    copy[k]--;
                    copy[l]--;
                    bool judge=true;
                    for(auto x:copy){
                        if(x.second>0) judge=false;
                    }
                    if(judge) ans++;
                }
            }
        }
    }
    cout << ans << endl;
}