#include #include const int Mod = 924844033; typedef struct { int left, right; long long sum, lx; } lazy_seg_node; void init_node(lazy_seg_node v[], int k, int l, int r) { v[k].left = l; v[k].right = r; v[k].sum = 0; v[k].lx = -1; if (l < r) { init_node(v, k << 1, l, (l + r) / 2); init_node(v, (k << 1) ^ 1, (l + r) / 2 + 1, r); } } void update_segment(lazy_seg_node v[], int k, int l, int r, long long x) { int i, j; if (v[k].left > r || v[k].right < l) return; else if (v[k].left >= l && v[k].right <= r) { v[k].lx = x; v[k].sum = (x * (v[k].right - v[k].left + 1)) % Mod; for (j = k, i = j >> 1; i > 0; j = i, i >>= 1) v[i].sum = (v[j].sum + v[j^1].sum) % Mod; } else { if (v[k].lx >= 0) { j = k << 1; v[j].sum = (v[k].lx * (v[j].right - v[j].left + 1)) % Mod; v[j^1].sum = (v[k].lx * (v[j^1].right - v[j^1].left + 1)) % Mod; v[j].lx = v[k].lx; v[j^1].lx = v[k].lx; v[k].lx = -1; } update_segment(v, k << 1, l, r, x); update_segment(v, (k << 1) ^ 1, l, r, x); } } long long get_sum(lazy_seg_node v[], int k, int l, int r) { int j; if (v[k].left > r || v[k].right < l) return 0; else if (v[k].left >= l && v[k].right <= r) return v[k].sum; else { if (v[k].lx >= 0) { j = k << 1; v[j].sum = (v[k].lx * (v[j].right - v[j].left + 1)) % Mod; v[j^1].sum = (v[k].lx * (v[j^1].right - v[j^1].left + 1)) % Mod; v[j].lx = v[k].lx; v[j^1].lx = v[k].lx; v[k].lx = -1; } return (get_sum(v, k << 1, l, r) + get_sum(v, (k << 1) ^ 1, l, r)) % Mod; } } int main() { char S[3000001]; scanf("%s", S); int i, j, k = 0, n = 0, A[3000001]; lazy_seg_node *v; for (i = 0; S[i] != 0; i = j) { if (S[i] != '0' && S[i] != '1') return -1; for (j = i + 1; S[j] == S[i]; j++); if (S[i] == '0') { if (n < j - i) n = j - i; A[k++] = i - j; } else A[k++] = j - i; } if (i > 3000000) return -1; v = (lazy_seg_node*)malloc(sizeof(lazy_seg_node) * (n + 1) * 4); init_node(v, 1, 1, n); long long ans = 1, zero_lr = 1; if (A[k-1] < 0) zero_lr = -A[--k] + 1; if (k > 0) { if (A[0] < 0) zero_lr = zero_lr * (-A[0] + 1) % Mod; ans = A[k-1]; for (i = k - 3, j = k - 2; i >= 0; i -= 2, j -= 2) { update_segment(v, 1, 1, -A[j], ans); ans += (get_sum(v, 1, 1, n) + 1) * A[i] % Mod; if (ans >= Mod) ans -= Mod; } } else zero_lr--; printf("%lld\n", ans * zero_lr % Mod); fflush(stdout); return 0; }