{"raw_statement":[{"iden":"problem statement","content":"There are positive integers $N$ and $M$.\nA binary string $s$ is called **good** if all of the followings are satisfied:\n\n*   $s$ is non-empty.\n*   The number of `1`s in $s$ is a multiple of $N$.\n*   The number of `0`s in $s$ is a multiple of $M$.\n\nA good string is called **perfect** if it doesn't contain shorter good (contiguous) substrings. For example, if $N = 3$ and $M = 2$, then strings `111`, `00` and `10101` are perfect, but `0000` and `11001` are not.\nOne can show that for any $N, M$ the number of perfect strings is finite. Find this number modulo $998\\,244\\,353$."},{"iden":"constraints","content":"*   $1 \\leq N, M \\leq 40$\n*   All values in the input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$"},{"iden":"sample input 1","content":"2 2"},{"iden":"sample output 1","content":"4\n\nThe perfect strings are `00`, `0101`, `1010`, `11`."},{"iden":"sample input 2","content":"3 2"},{"iden":"sample output 2","content":"7\n\nThe perfect strings are `00`, `01011`, `01101`, `10101`, `10110`, `11010`, `111`."},{"iden":"sample input 3","content":"23 35"},{"iden":"sample output 3","content":"212685109"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}