local mce, mfl, msq, mmi, mma, mab = math.ceil, math.floor, math.sqrt, math.min, math.max, math.abs local bls, brs = bit.lshift, bit.rshift local function getprimes(x) local primes = {} local allnums = {} for i = 1, x do allnums[i] = true end for i = 2, x do if allnums[i] then table.insert(primes, i) local lim = mfl(x / i) for j = 2, lim do allnums[j * i] = false end end end return primes end local primes = getprimes(1000000) local function isprime(x) for i = 1, #primes do if x == primes[i] then return true end if x % primes[i] == 0 then return false end end return true end local s = io.read() local n = #s local t = {} for i = 1, n do t[i] = s:byte(i) - 48 end local ret = 0 local tot = bls(1, n - 1) for i = 0, tot - 1 do local v = 0 local c = t[1] local ti = i for j = 2, n do if ti % 2 == 0 then c = c * 10 + t[j] else v = v + c c = t[j] end ti = brs(ti, 1) end v = v + c -- print(v) if isprime(v) then ret = ret + 1 end end print(ret)