def is_Prime(x): if x == 1: return False for i in range(2, int(x ** 0.5) + 1): if x % i == 0: return False return True s = input() n = len(s) ans = 0 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('+') ans += is_Prime(eval(''.join(t))) print(ans)