#P6973. Lidia's Prime Sets Notebook Substring Extraction

    ID: 20180 Type: Default 1000ms 256MiB

Lidia's Prime Sets Notebook Substring Extraction

Lidia's Prime Sets Notebook Substring Extraction

Lidia loves sets of prime numbers and writes them in her Extremely Long Notebook for Prime Sets. In the notebook each non‐empty set is written in JSON array format with its elements in ascending order and separated by a comma and a space. For example, the beginning of the notebook is:

[2], [3], [2 , 3], [5], [2 , 5], [7], [3 , 5], [2 , 7], [2 , 3 , 5], [3 , 7], [11], [2 , 3 , 7], [5 , 7], [2 , 11], [13], [2 , 5 , 7], …

The sets are ordered first by the sum of their elements and then, if two sets have the same sum, in lexicographical order (i.e. comparing the first element, then the second, etc.).

You are given two integers \(a\) and \(b\) (with \(1 \le a \le b\)). Treating the notebook as an infinitely long string (with a comma and a space ", " following each set), output the substring of the notebook from position \(a\) to position \(b\) (inclusive). Note that the positions are 1-indexed.

Input format: Two integers \(a\) and \(b\) on a single line separated by a space.

Output format: A single line containing the required substring of the notebook.

inputFormat

The input consists of two space-separated integers \(a\) and \(b\) where \(1 \leq a \leq b\). They represent positions in the infinite notebook (1-indexed).

outputFormat

Output a single line containing the substring of Lidia's notebook from position \(a\) to position \(b\) (inclusive).

sample

1 10
[2], [3],