// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

const ll mod = 998244353;
ll N;
string X;
ll dp[(size_t)2e5 + 10][2];

ll calc_dp(ll len) {
    dp[0][0] = 1;
    for(ll i = 0; i < X.size(); i++) {
        dp[i + 1][0] = dp[i + 1][1] = 0;
        if(i < len) {
            dp[i + 1][0] += dp[i][0];
            dp[i + 1][1] += 2 * dp[i][1] % mod;
            if(X[i] == '1') (dp[i + 1][1] += dp[i][0]) %= mod;
        } else {
            dp[i + 1][1] += dp[i][1];
            ll idx = i / len;
            bool one = X[i % len] == '1';
            if(idx & 1) one = !one;
            if(one && X[i] == '0') {
                dp[i + 1][0] = 0;
            } else if(!one && X[i] == '1') {
                dp[i + 1][1] += dp[i][0];
                dp[i][0] = 0;
            } else {
                dp[i + 1][0] += dp[i][0];
            }
        }

        dp[i + 1][0] %= mod;
        dp[i + 1][1] %= mod;
    }
    return (dp[X.size()][0] + dp[X.size()][1]) % mod;
}

int main() {
    cin >> N >> X;

    V<ll> calc(N + 1);

    auto check = [&](ll len) {
        if(X.size() % len) return false;
        if((X.size() / len) % 2 == 0) return false;
        return true;
    };

    for(ll i = 1; i <= X.size(); i++) {
        if(!check(i)) continue;
        calc[i] = calc_dp(i);
    }

    ll cnt_sum = 0;
    ll ans = 0;

    DEBUG(calc);

    for(ll i = 1; i < N; i++) {
        if(!check(i)) continue;
        DEBUG(i, calc[i]);
        ans += 2 * i * calc[i] % mod;
        cnt_sum += calc[i];
        for(ll j = 2; i * j <= N; j++) (calc[i * j] += mod - calc[i]) %= mod;
    }

    cnt_sum %= mod;
    DEBUG(cnt_sum);
    ans %= mod;

    DEBUG(ans);

    ll all_num = 1, pow2 = 1;
    for(ll i = 0; i < N; i++) {
        if(X[N - i - 1] == '1') (all_num += pow2) %= mod;
        (pow2 *= 2) %= mod;
    }

    DEBUG(all_num);
    DEBUG(ans);
    DEBUG(all_num * 2 * N);

    (ans += (all_num - cnt_sum + mod) * 2 * N % mod) %= mod;

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5268