def is_prime(number): if number < 2: return False if number == 2: return True if number % 2 == 0: return False for p in range(3, int(number ** 0.5) + 1, 2): if number % p == 0: return False return True S = input() ans = 0 for bit in range(2 ** (len(S)-1)): siki = S[0] for j in range(len(S)-1): if bit >> j & 1: siki += "+" siki += S[j+1] if is_prime(eval(siki)): ans += 1 print(ans)