#include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; #define rep(i,n) for (int i = 0; i < int(n);i++) int main(){ string s; cin >> s; int ans = 0; int n = s.size()-1; for (int bit = 0; bit < (1 << n);bit++){ ll res = 0; int pos = 0; int len = 1; for (int i = 0; i < n;i++){ if (bit & 1 << i){ res += stoll(s.substr(pos,len)); len = 1; pos = i+1; } else len++; } res += stoll(s.substr(pos,n+1)); bool isprime = true; for (ll i = 2; i*i <= res;i++){ if (res%i == 0) { isprime = false; break; } } if (res == 1) isprime = false; if (isprime) ans++; } cout << ans << endl; return 0; }