Oneday,MiovisitsanAnimationComicGameNovel(ACGN)Exhibition,andshewouldliketobuysomepresentsforRitsu. Weassurethatthespaceoftheexhibitionisan×mgrid,calledthegridA,andeachcellinthegridrepresentsasta
One day, Mio visits an Animation Comic Game Novel (ACGN) Exhibition, and she would like to buy some presents for Ritsu. We assure that the space of the exhibition is a n × m grid, called the grid A, and each cell in the grid represents a stall, only selling present 0 or 1. In other words, every cell of the n × m grid A is filled with 0 or 1. Under the control policy for containing COVID−19, there are some restrictions on visiting route. We define a SAFE PATH as a path from the top left cell (1,1), to the bottom right cell (n,m), and if you are in the cell (x,y), then you can only travel to the cells (x+1,y) or (x,y+1). Every visitor has to visit the exhibition through SAFE PATH, so does Mio. The two paths are considered to be different if and only if at least one cell passed differs.Mio wonders how many different SAFE PATHs, which have some 0s and 1s, and the number of 0 is at least p, the number of 1 is at least q. Since the answer may be too large, you only need to output the result modulo 998244353.