Problem: You are given a string s consisting of characters "1", "0", and "?". The first character of s is guaranteed to be "1". Let m be the number of characters in s.

Count the number of ways we can choose a pair of integers a, b that satisfies the following: 

  * 1 ≤ a < b < 2^m 
  * When written without leading zeros, the base-2 representations of a and b are both palindromes. 
  * The base-2 representation of bitwise XOR of a and b matches the pattern s. We say that t matches s if the lengths of t and s are the same and for every i, the i-th character of t is equal to the i-th character of s, or the i-th character of s is "?". 



Compute this count modulo 998244353. 

Input

The first line contains a single string s (1 ≤ |s| ≤ 1 000). s consists only of characters "1", "0" and "?". It is guaranteed that the first character of s is a "1".

Output

Print a single integer, the count of pairs that satisfy the conditions modulo 998244353.

Examples

Input


10110


Output


3


Input


1?0???10


Output


44


Input


1?????????????????????????????????????


Output


519569202


Input


1


Output


0

Note

For the first example, the pairs in base-2 are (111, 10001), (11, 10101), (1001, 11111).

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        private static final int MODULO = 998244353;
        int id;
        int[][] visShort;
        int[][] visLong;
        boolean[] badComps;
        char[] s;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            int n = s.length;

            this.s = s;
            visShort = new int[n][2];
            visLong = new int[n][2];
            badComps = new boolean[n * 4];

            long ans = 0;
            for (int i = 1; i < n; ++i) {
                ans = (ans + go(i)) % MODULO;
            }
            out.println(ans);
        }

        void dfsShort(int pos, int n, int start, int val) {
            if (pos == 0 && val == 0) {
                badComps[id] = true;
            }
            visShort[pos][val] = id;
            int shortN = n - start;
            int mirror = shortN - pos - 1;
            if (visShort[mirror][val] == 0) {
                dfsShort(mirror, n, start, val);
            }
            int posLong = pos + start;

            if (s[posLong] == '0') {
                if (visLong[posLong][val] == 0) {
                    dfsLong(posLong, n, start, val);
                }
            }
            if (s[posLong] == '1') {
                if (visLong[posLong][val ^ 1] == 0) {
                    dfsLong(posLong, n, start, val ^ 1);
                }
            }
        }

        void dfsLong(int pos, int n, int start, int val) {
            if (pos == 0 && val == 0) {
                badComps[id] = true;
            }
            visLong[pos][val] = id;
            int mirror = n - pos - 1;
            if (visLong[mirror][val] == 0) {
                dfsLong(mirror, n, start, val);
            }
            if (pos >= start) {
                int posShort = pos - start;
                if (s[pos] == '0') {
                    if (visShort[posShort][val] == 0) {
                        dfsShort(posShort, n, start, val);
                    }
                }
                if (s[pos] == '1') {
                    if (visShort[posShort][val ^ 1] == 0) {
                        dfsShort(posShort, n, start, val ^ 1);
                    }
                }
            } else {
                if (s[pos] == '0' && val == 1) {
                    badComps[id] = true;
                }
                if (s[pos] == '1' && val == 0) {
                    badComps[id] = true;
                }
            }
        }

        private long go(int start) {
            int n = s.length;
            int shortN = n - start;

            Arrays.fill(badComps, false);
            for (int i = 0; i < n; ++i) {
                Arrays.fill(visShort[i], 0);
                Arrays.fill(visLong[i], 0);
            }

            id = 0;

            long ans = 1;

            ++id;
            dfsLong(0, n, start, 0);
            ++id;
            dfsShort(0, n, start, 0);


            for (int i = 0; i < n; ++i) {
                int free = 0;
                if (visLong[i][0] != 0 && visLong[i][1] != 0) {
                    continue;
                }
                for (int val = 0; val < 2; ++val) {
                    if (visLong[i][val] == 0) {
                        ++id;
                        dfsLong(i, n, start, val);
                        if (!badComps[id]) {
                            ++free;
                        }
                    }
                }
                ans = ans * free % MODULO;
            }
            for (int i = 0; i < shortN; ++i) {
                int free = 0;
                if (visShort[i][0] != 0 && visShort[i][1] != 0) {
                    continue;
                }
                for (int val = 0; val < 2; ++val) {
                    if (visShort[i][val] == 0) {
                        ++id;
                        dfsShort(i, n, start, val);
                        if (!badComps[id]) {
                            ++free;
                        }
                    }
                }
                ans = ans * free % MODULO;
            }

            for (int i = 0; i < n; ++i) {
                if (visLong[i][0] == visLong[i][1]) {
                    return 0;
                }
            }
            for (int i = 0; i < shortN; ++i) {
                if (visShort[i][0] == visShort[i][1]) {
                    return 0;
                }
            }

            return ans;
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new UnknownError();
                }
            }
            return tokenizer.nextToken();
        }

    }
}