atcoder#ABC198F. [ABC198F] Cube

[ABC198F] Cube

Score : 600600 points

Problem Statement

Let us write a positive integer on each face of a cube. How many ways are there to do this so that the sum of the six numbers written is SS?

Here, two ways to write numbers are not distinguished when they only differ by rotation. (Numbers have no direction.)

The count can be enormous, so find it modulo 998244353998244353.

Constraints

  • 6S10186 \leq S \leq 10^{18}
  • SS is an integer.

Input

Input is given from Standard Input in the following format:

SS

Output

Print the count modulo 998244353998244353.

8
3

We have one way to write 1,1,1,1,1,31,1,1,1,1,3 on the cube and two ways to write 1,1,1,1,2,21,1,1,1,2,2 (one where we write 22 on adjacent faces and another where we write 22 on opposite faces), for a total of three ways.

9
5
50
80132
10000000000
2239716

Find the count modulo 998244353998244353.