You are given two integers L and R. Your task is to determine the sum of all the beautiful numbers from the range [L, R].
A number represents a beautiful number if it satisfies the following condition:
For further clarification, please refer to the explanation of the sample test case.
Example
Consider L=1, R = 2. You have to determine the sum of all the beautiful numbers from the range [L, R].
Here the answer is 1 as 2 is not a beautiful number.
Function description:
Complete the solve function provided in the editor. This function takes the following 2 parameters and returns the sum of all the beautiful numbers from the range [L, R].
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
Output format
For each test case, print a value that represents the sum of the beautiful numbers in the range [L, R].
Note: You are required to print the answers for each test case in a new line.
Constraints
1≤T≤1061≤L≤R≤106
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
For the first test case, both 31 and 32 can be reduced to 1, therefore the output is 63. For example: