QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#10501. Polygonal chain

الإحصائيات

Jasio draws a polygonal chain on a large sheet of grid paper in the following way. He starts at the top-left corner of the sheet and, without lifting his pencil, draws consecutive segments of the chain in one of three ways:

(a) to the right along the side of a grid square (length of one grid unit), (b) downwards along the side of a grid square (length of one grid unit), (c) to the right and downwards along the diagonal of a grid square.

The figure below shows an example of a polygonal chain (consisting of 4 segments) that Jasio might draw.

After drawing the chain, Jasio calculates its length. For this purpose, he wrote a function in C++:

std::string dlugosc(const std::string& lamana) {
    int proste = 0, przekatne = 0;
    for (char odcinek : lamana) {
        if (odcinek == 'c')
            przekatne++;
        else
            proste++;
    }
    long double wynik = sqrtl(2.0) * przekatne + proste;
    char buf[30];
    sprintf(buf, "%.6Lf", wynik);
    return buf;
}

The function dlugosc takes as an argument a sequence of consecutive moves (characters 'a', 'b', or 'c', representing a move to the right, downwards, or along the diagonal, respectively). The function sqrtl is the standard square root function (from the cmath library). You may assume that the dlugosc function works the same way on Jasio's computer, on your workstation, and on the judging system.

Jasio has given you the result of the dlugosc function (or so he claims). He would like to know how many polygonal chains consisting of at most $10^9$ segments (corresponding to valid arguments for the function) result in exactly this value. Help him answer this question.

Input

The only line of input contains a single real number $l$ ($0 < l \le 10^9$), with exactly six digits after the decimal point, representing the length of the chain provided by Jasio and simultaneously the potential value returned by the dlugosc function.

Output

The only line of output should contain the number of polygonal chains that satisfy the problem conditions. If this number is greater than $10^{18}$, you should output the word SPORO instead.

Remember that Jasio might be bluffing and the value he provided might not be the result of the dlugosc function for any valid argument—in that case, you should output 0.

Examples

Input 1

2.414214

Output 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.