{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eTakahashi has a tower which is divided into \u003cvar\u003e\\(N\\)\u003c/var\u003e layers.\r\nInitially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower.\r\nHe defines the \u003cem\u003ebeauty of the tower\u003c/em\u003e as follows:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eThe beauty of the tower is the sum of the scores of the \u003cvar\u003e\\(N\\)\u003c/var\u003e layers, where the score of a layer is \u003cvar\u003e\\(A\\)\u003c/var\u003e if the layer is painted red, \u003cvar\u003e\\(A+B\\)\u003c/var\u003e if the layer is painted green, \u003cvar\u003e\\(B\\)\u003c/var\u003e if the layer is painted blue, and \u003cvar\u003e\\(0\\)\u003c/var\u003e if the layer is uncolored.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eHere, \u003cvar\u003e\\(A\\)\u003c/var\u003e and \u003cvar\u003e\\(B\\)\u003c/var\u003e are positive integer constants given beforehand. Also note that a layer may not be painted in two or more colors.\u003c/p\u003e\r\n\u003cp\u003eTakahashi is planning to paint the tower so that the beauty of the tower becomes exactly \u003cvar\u003e\\(K\\)\u003c/var\u003e.\r\nHow many such ways are there to paint the tower? Find the count modulo \u003cvar\u003e\\(998244353\\)\u003c/var\u003e.\r\nTwo ways to paint the tower are considered different when there exists a layer that is painted in different colors, or a layer that is painted in some color in one of the ways and not in the other.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ N ≤ 3×10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ A,B ≤ 3×10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0 ≤ K ≤ 18×10^{10}\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eAll values in the input are integers.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(A\\)\u003c/var\u003e \u003cvar\u003e\\(B\\)\u003c/var\u003e \u003cvar\u003e\\(K\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the number of the ways to paint tiles, modulo \u003cvar\u003e\\(998244353\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 1 2 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e40\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eIn this case, a red layer worth \u003cvar\u003e\\(1\\)\u003c/var\u003e points, a green layer worth \u003cvar\u003e\\(3\\)\u003c/var\u003e points and the blue layer worth \u003cvar\u003e\\(2\\)\u003c/var\u003e points. The beauty of the tower is \u003cvar\u003e\\(5\\)\u003c/var\u003e when we have one of the following sets of painted layers:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1\\)\u003c/var\u003e green, \u003cvar\u003e\\(1\\)\u003c/var\u003e blue\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1\\)\u003c/var\u003e red, \u003cvar\u003e\\(2\\)\u003c/var\u003e blues\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(2\\)\u003c/var\u003e reds, \u003cvar\u003e\\(1\\)\u003c/var\u003e green\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(3\\)\u003c/var\u003e reds, \u003cvar\u003e\\(1\\)\u003c/var\u003e blue\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eThe total number of the ways to produce them is \u003cvar\u003e\\(40\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 5 6 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThe beauty of the tower is \u003cvar\u003e\\(0\\)\u003c/var\u003e only when all the layers are uncolored. Thus, the answer is \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e90081 33447 90629 6391049189\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e577742975\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}