def is_prime(n): if n == 1: return False limit = int(n**0.5)+1 for i in range(2, limit): if n%i == 0: return False return True def main(): s = input() ans = 0 n = len(s) for b in range(2**(n-1)): formula = [] for i in range(n): formula.append(s[i]) if i>i)&1: formula.append('+') ans += is_prime(eval(''.join(formula))) print(ans) main()