import itertools s = list(input()) s_space = list(" ".join(s)) result = [] lis=list(range(0,len(s)-1)) def judge(n): for i in range(2,n): if n%i==0: return 0 return 1 for n in range(0,len(lis)+1): for conb in itertools.combinations(lis, n): result.append(list(conb)) count = 0 for i in result: s_v = s_space.copy() for j in i: s_v[j*2+1]="+" v = eval("".join(list(filter(lambda x:x!=" ",s_v)))) count += judge(v) print(count)