SP8283 NONDEC - Non-Decreasing Numbers
Description
A Non-Decreasing number is a number whose ith digit from the left it greater than or equal to the (i-1)th digit from the left.
You are given four integers A, B, C and D. X is any integer b/w A and B, inclusive, and Y is any integer b/w C and D, inclusive. You must output the number of numbers formed by the concatenation of X and Y which are Non-Decreasing, i.e. if we treat "X" and "Y" as STRINGS, then "Z" = "X" + "Y" must represent a Non-Decreasing number.
Since this number can be very large, give your answer modulo 98765431.
If the same number "Z" can be formed in various ways, it must be counted every time. See example for clarification.
Input Format
The first line of the input contains t, the number of test cases.
This is followed by t lines containing 4 positive integers each, which are the values of A, B, C, D.
Output Format
You must output t lines. Each line contains the answers for the quadruple (A, B, C, D) in the order they appear in input.