Problem:
Score : 1400 points

Problem Statement

Consider the following set of rules for encoding strings consisting of 0 and 1:

Strings 0 and 1 can be encoded as 0 and 1, respectively.

If strings A and B can be encoded as P and Q, respectively, then string AB can be encoded as PQ.

If string A can be encoded as P and K \geq 2 is a positive integer, then string AA...A (A repeated K times) can be encoded as (PxK).

For example, string 001001001, among other possibilities, can be encoded as 001001001, 00(1(0x2)x2)1 and (001x3).

Let's call string A a subset of string B if:

A and B are equal in length and consist of 0 and 1;

for all indices i such that A_i = 1, it's also true that B_i = 1.

You are given string S consisting of 0 and 1. Find the total number of distinct encodings of all subsets of S, modulo 998244353.

Constraints

1 \leq |S| \leq 100

S consists of 0 and 1.

Input

Input is given from Standard Input in the following format:

S

Output

Print the total number of distinct encodings of all subsets of S modulo 998244353.

Sample Input 1

011

Sample Output 1

9

There are four subsets of S:

011 can be encoded as 011 and 0(1x2);

010 can be encoded as 010;

001 can be encoded as 001 and (0x2)1;

000 can be encoded as 000, 0(0x2), (0x2)0 and (0x3).

Thus, the total number of encodings of all subsets of S is 2 + 1 + 2 + 4 = 9.

Sample Input 2

0000

Sample Output 2

10

This time S has only one subset, but it can be encoded in 10 different ways.

Sample Input 3

101110

Sample Output 3

156

Sample Input 4

001110111010110001100000100111

Sample Output 4

363383189

Don't forget to take the result modulo 998244353.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


const int MOD = 998244353;
void sadd(int &a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
}
int add(int a, int b)
{
    sadd(a, b);
    return a;
}
void ssub(int &a, int b)
{
    a -= b;
    if (a < 0) a += MOD;
}
int sub(int a, int b)
{
    ssub(a, b);
    return a;
}
int mul(int a, int b)
{
    return (a * 1LL * b) % MOD;
}

const int N = 105;
char str[N];

map <string, int> dp[2];

int solve(const string &s, bool sp = false)
{
 //   eprintf("%s %d\n", s.c_str(), sp);
    if (dp[sp].count(s) ) return dp[sp][s];

    if ((int) s.length() == 1)
    {
        int zeros = (s == "0");
        if (zeros) return dp[sp][s] = 1;
        return dp[sp][s] = 2;
    }
    int ans = 0;
   
    if (!sp)
    {
        for (int i = 1; i < (int) s.length(); i++)
        {
            string pref = s.substr(0, i), suff = s.substr(i);
            sadd(ans, mul(solve(pref, (i > 1) ), solve(suff) ) );
        }
    }
    for (int i = 1; i < (int) s.length(); i++)
    {
        if (((int) s.length() ) % i != 0) continue;
        string x = string(i, '1');
        for (int j = 0; j < (int) s.length(); j++)
        {
            if (s[j] == '0')
                x[j % i] = '0';
        }
        sadd(ans, solve(x) );
    }

 //   eprintf("%s %d : %d\n", s.c_str(), sp, ans);
    return dp[sp][s] = ans;
}


int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    scanf("%s", str);

    int ans = solve(string(str) );
    printf("%d\n", ans);



	return 0;
}