#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const double pi = acos(-1.0);
const int MOD = 998244353;
int i, j, k, m, n, l;
int ans;
const int N = 2005;
int a[N];
int d[N*N];

int gcd(int x, int y) {
    return y ? gcd(y, x%y) : x;
}
 
void solve() {
    int g = a[0];
    F0(i, n) g = gcd(g, a[i]);
    sort(a, a + n);
    
    reverse(a, a + n);
    int s = 0;
    F0(i, n) { a[i] /= g; s += a[i]; }

    CL(0, d);
    d[0] = 1;
    int ss = 0;
    F0(i, n) {
        int x = a[i];
        for (int i = ss; i >= 0; i--) if (d[i]) d[i + x] = 1;
        ss += x;
        if (d[(s+1)/2]) {
            //cout << i << endl;
            break;
        }
    }
    for (int i = (s + 1) / 2; 1; i++) if (d[i]) { ans = i; break; }
    
    //cout << ans - (s + 1) / 2 << endl;
    cout << ans * g << endl;
}
 
void test() {
    n = 2000;
    F0(i, n) a[i] = rand()%2000+1;
    solve();
}

// AAAB AAAB AAAB AAAB AAAB AAAB 
// ABBB ABBB

void solve2() {
    int tn; cin >> tn; while (tn--) {
        int A, B, C, D;
        
        tn++;
        A = rand()%13+1;
        B = rand()%43+1;
        C = 1; D = A + B;
        
        string s;
        cin >> A >> B >> C >> D;
        if (A >= B) {
            k = (A + B) / (B + 1);
        } else {
            k = (A + B) / (A + 1);
        }
        
        string good = string(k, 'A') + "B";
        string bad = "A" + string(k, 'B');
        
        cout << k << " " << good << " " << bad << endl;
        s = "";
        
        if ((A + B) % (k + 1) == 0) continue;
        int groups = (A + B) / (k + 1);
        for (int i = groups; i >= 0; i--) {
            int lefta = A - k * i - (groups - i);
            int leftb = B - i - (groups - i) * k;
            if ((lefta > 0 && leftb > 0) || (!lefta && (i > 0) + leftb <= k) || (!leftb && lefta + (i < groups) <= k)) {
                
                F0(x, i) s += good;
                s += string(lefta, 'A') + string(leftb, 'B');
                F0(x, groups - i) s += bad; 
                break;
            }
        }
        if (s == "") {
            cout << A << " " << B << endl;
            exit(0);
        }
        //cout << s << endl;
        cout << s.substr(C - 1, D - C + 1) << endl;
    }
}

map<string, int> M;
int rec(string s) {
    if (s.empty()) return 1;
    if (M.count(s)) return M[s];
    int& ret = M[s];
    
    int sz = SZ(s);
    ret = rec(s.substr(0, sz - 1));
    if (s[sz - 1] == '1') ret = (ret * 2) % MOD;
    
    for (int g = 2; g <= sz; g++) {
        for (int i = 1; i * g <= sz; i++) {
            string p(i, '1');
            int f = sz - i * g;
            F0(j, i * g) if (s[f + j] == '0') p[j % i] = '0';
            ll x = rec(p);
            ll y = rec(s.substr(0, f));
            ret = (ret + (x * y) % MOD) % MOD;
        }
    }
    //cout << s << " " << ret << endl;
    return ret;
}

void solve3() {
    string s;
    cin >> s;
    ans = rec(s);
    cout << ans << endl;
}
 
int main() {
    solve3(); exit(0);

    solve2(); exit(0);
    
	//while (1) test();
	while (cin >> n) {
	    F0(i, n) scanf("%d", &a[i]);
	    solve();
	}
	
	return 0;
}

Measured memory_bytes: 5632