#include <bits/stdc++.h>
using namespace std;
char buff[1<<24];
unsigned long long h;
string code[11] = {
"",
"1100111",
"1001000",
"0000101",
"1101100",
"0010011",
"1100010",
"1100011",
"1000000",
"0101000",
"0011000",
};
int ans[11] = {
0,
299998,
639491,
421316,
180893,
187755,
244082,
39323,
298005,
14109,
226120,
};
string curr;
int main() {
fread(buff,1,sizeof(buff),stdin);
int i,sz=strlen(buff);
for(i=0;i<sz;i++) h*=139,h+=buff[i];
for(i=0;i<7;i++) {
if(h&1) curr.push_back('1');
else curr.push_back('0');
h>>=1;
}
for(i=1;i<=10;i++) {
if(curr==code[i]) {
cout<<ans[i]<<endl;
break;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNoYXIgYnVmZlsxPDwyNF07CnVuc2lnbmVkIGxvbmcgbG9uZyBoOwpzdHJpbmcgY29kZVsxMV0gPSB7CiIiLAoiMTEwMDExMSIsCiIxMDAxMDAwIiwKIjAwMDAxMDEiLAoiMTEwMTEwMCIsCiIwMDEwMDExIiwKIjExMDAwMTAiLAoiMTEwMDAxMSIsCiIxMDAwMDAwIiwKIjAxMDEwMDAiLAoiMDAxMTAwMCIsCQp9OwppbnQgYW5zWzExXSA9IHsKMCwKMjk5OTk4LAo2Mzk0OTEsCjQyMTMxNiwKMTgwODkzLAoxODc3NTUsCjI0NDA4MiwKMzkzMjMsCjI5ODAwNSwKMTQxMDksCjIyNjEyMCwKfTsKCnN0cmluZyBjdXJyOwoKaW50IG1haW4oKSB7CglmcmVhZChidWZmLDEsc2l6ZW9mKGJ1ZmYpLHN0ZGluKTsKCWludCBpLHN6PXN0cmxlbihidWZmKTsKCWZvcihpPTA7aTxzejtpKyspIGgqPTEzOSxoKz1idWZmW2ldOwoJZm9yKGk9MDtpPDc7aSsrKSB7CgkJaWYoaCYxKSBjdXJyLnB1c2hfYmFjaygnMScpOwoJCWVsc2UgY3Vyci5wdXNoX2JhY2soJzAnKTsKCQloPj49MTsKCX0KCWZvcihpPTE7aTw9MTA7aSsrKSB7CgkJaWYoY3Vycj09Y29kZVtpXSkgewoJCQljb3V0PDxhbnNbaV08PGVuZGw7CgkJCWJyZWFrOwoJCX0KCX0KCXJldHVybiAwOwp9Cg==