{"raw_statement":[{"iden":"statement","content":"Alex enjoys eating snacks, in particular candies. Recently he discovered a brand of berry-themed juicy candies, with three flavors: blueberry (B), raspberry (R), and strawberry (S). For brevity, we would, for example, use the term _B-candy_ to refer to blueberry-flavored candy.\n\nAlex has B B-candies, R R-candies, and S S-candies. He now wants to form sequences of candies, such that:\n\nFor each candy sequence, there is a string of length (B + R + S) corresponding to it. If the i-th candy in the sequence is strawberry-flavored, for example, then the i-th character of the string would be _S_. Similarly for blueberry- and raspberry-flavored candies.\n\nBefore enjoying the candies, Alex would like to solve the following challenge: among all strings which corresponds to a candy sequence, what is the K-th lexicographically smallest string?\n\nFor two strings s[1...L] and t[1...L], s is said to be lexicographically smaller than t, if there exists an index i (1 ≤ i ≤ L), such that s[j = t[j]] for 1 ≤ j < i, and s[i < t[i]]. We naturally use the character relation _B_  <  _R_  <  _S_.\n\nThe first and only line of input consists of four space-separated integers B, R, S, and K.\n\nFor all test cases, 1 ≤ B, R, S ≤ 200, 1 ≤ K ≤ 1018.\n\nIf the total number of strings is less than K, output _None_.\n\nOtherwise, output the K-th lexicographically smallest string that corresponds to a candy sequence with B B-candies, R R-candies, and S S-candies.\n\n"},{"iden":"input","content":"The first and only line of input consists of four space-separated integers B, R, S, and K.For all test cases, 1 ≤ B, R, S ≤ 200, 1 ≤ K ≤ 1018."},{"iden":"output","content":"If the total number of strings is less than K, output _None_.Otherwise, output the K-th lexicographically smallest string that corresponds to a candy sequence with B B-candies, R R-candies, and S S-candies."},{"iden":"examples","content":"Input1 1 1 1OutputBRSInput3 1 1 1OutputBRBSBInput1 4 1 1OutputNoneInput2 3 4 40OutputSBRSRSBSRInput7 7 7 777OutputBRBRBRSRSBSRSBRSBSBSRInput7 7 7 7777OutputBRBRSRBSRSRBRBSRSBSBSInput7 7 7 177777OutputRSBRBSRSRBSRBRSBSBSBR"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ B, R, S \\in \\mathbb{Z}_{\\geq 0} $ denote the counts of B-, R-, and S-candies, respectively.  \nLet $ L = B + R + S $.  \nLet $ \\Sigma = \\{B, R, S\\} $ with lexicographic order $ B < R < S $.  \nLet $ \\mathcal{S}(B, R, S) $ be the set of all strings of length $ L $ over $ \\Sigma $ with exactly $ B $ occurrences of $ B $, $ R $ occurrences of $ R $, and $ S $ occurrences of $ S $.\n\n**Constraints**  \n1. $ 1 \\leq B, R, S \\leq 200 $  \n2. $ 1 \\leq K \\leq 10^{18} $  \n3. $ |\\mathcal{S}(B, R, S)| = \\binom{L}{B, R, S} = \\frac{L!}{B! \\, R! \\, S!} $\n\n**Objective**  \nIf $ \\binom{L}{B, R, S} < K $, output \"None\".  \nOtherwise, output the $ K $-th lexicographically smallest string in $ \\mathcal{S}(B, R, S) $.","simple_statement":"Given B blueberry, R raspberry, and S strawberry candies, find the K-th lexicographically smallest string formed by using all candies (B times 'B', R times 'R', S times 'S'), where B < R < S. If there are fewer than K such strings, output \"None\".","has_page_source":false}