def is_prime(x): for i in range(2, int(x ** 0.5) + 1): if x % i == 0: return 0 return 1 res = 0 s = input() n = len(s) for b in range(1 << (n - 1)): t = [] for i in range(n): t.append(s[i]) if i < n - 1 and b >> i & 1: t.append('+') res += is_prime(eval(''.join(t))) print(res)