S = gets.strip def isPrime?(n) false if n == 1 true if n == 2 2.upto(Integer.sqrt(n)) {|i| return false if n % i == 0 } true end s = S.split("") cnt = 0 ["","+"].repeated_permutation(s.length-1) {|e| ss = s[0] 0.upto(s.length-2) {|i| ss += e[i] + s[i+1] } n = eval(ss) cnt += 1 if isPrime?(n) } puts cnt