We call a positive integer *x* a *k*-beautiful integer if and only if it is possible to split the multiset of its digits in the decimal representation into two subsets such that the difference between the sum of digits in one subset and the sum of digits in the other subset is less than or equal to *k*. Each digit should belong to exactly one subset after the split.

There are *n* queries for you. Each query is described with three integers *l*, *r* and *k*, which mean that you are asked how many integers *x* between *l* and *r* (inclusive) are *k*-beautiful.
The first line contains a single integer *n* (1 ≤ *n* ≤ 5·10<sup class="upper-index">4</sup>), indicating the number of queries.

Each of the next *n* lines describes a query, containing three integers *l*, *r* and *k* (1 ≤ *l* ≤ *r* ≤ 10<sup class="upper-index">18</sup>, 0 ≤ *k* ≤ 9).
If 1 ≤ *x* ≤ 9, integer *x* is *k*-beautiful if and only if *x* ≤ *k*.

If 10 ≤ *x* ≤ 99, integer *x* = 10*a* + *b* is *k*-beautiful if and only if |*a* - *b*| ≤ *k*, where *a* and *b* are integers between 0 and 9, inclusive.

100 is *k*-beautiful if and only if *k* ≥ 1.
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

class vec;

inline ld fx(ld x, ld y, ld a) {
    return sqrt(pow(e, (-a - 2 * x - cos(y))*2) - 1);
}

inline ld fy(ld x, ld y, ld a) {
    return arcsin(2 * (-pow(e, -x * x) - log((1 + y)/(1 - y))));
}

inline vec f(vec &v, ld alpha) {
    return vec(fx(v.x, v.y, alpha), fy(v.x, v.y, alpha));
}

inline int print(vec &v) {
    cout << v.x << " " << v.y << endl;
}

class vec {
private:
    ld x, y;
public:
    vec(ld xx = 0, ld yy = 0) {
        x = xx;
        y = yy;
    }
    vec(vec &old) {
        x = old.x;
        y = old.y;
    }
    vec(vec &&old) {
        x = old.x;
        y = old.y;
    }
    ~vec() {
        x = y = 0;
    }
    friend int print(vec &);
    friend vec f(vec &, ld);
};

int main() {
    vec v;
    for(int i = 0; i < 10000; ++i) {
        v = f(v, 1);
    }
    print(v);
    return 0;
}
