Problem: Vasya has recently bought some land and decided to surround it with a wooden fence.

He went to a company called "Wooden board" that produces wooden boards for fences. Vasya read in the catalog of products that the company has at its disposal n different types of wood. The company uses the i-th type of wood to produce a board of this type that is a rectangular ai by bi block.

Vasya decided to order boards in this company and build a fence from them. It turned out that the storehouse of the company is so large that Vasya can order arbitrary number of boards of every type. Note that Vasya is allowed to turn the boards as he builds the fence. However, Vasya cannot turn square boards.

Vasya is required to construct a fence of length l, however, an arbitrary fence won't do. Vasya wants his fence to look beautiful. We'll say that a fence is beautiful if and only if the following two conditions are fulfilled:

  * there are no two successive boards of the same type 
  * the first board of the fence has an arbitrary length, and the length of each subsequent board equals the width of the previous one 



In other words, the fence is considered beautiful, if the type of the i-th board in the fence is different from the i - 1-th board's type; besides, the i-th board's length is equal to the i - 1-th board's width (for all i, starting from 2).

Now Vasya wonders, how many variants of arranging a fence for his land exist. Your task is to count the number of different beautiful fences of length l.

Two fences will be considered the same if the corresponding sequences of fence boards types and rotations are the same, otherwise the fences are different. Since the sought number can be large enough, you need to calculate the answer modulo 1000000007 (109 + 7).

Input

The first line contains two integers n and l (1 ≤ n ≤ 100, 1 ≤ l ≤ 3000) — the number of different board types and the fence length, correspondingly. Next n lines contain descriptions of board types: the i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ 100) — the sizes of the board of the i-th type. All numbers on the lines are separated by spaces.

Output

Print a single integer — the sought number of variants modulo 1000000007 (109 + 7).

Examples

Input

2 3
1 2
2 3


Output

2


Input

1 2
2 2


Output

1


Input

6 6
2 1
3 2
2 5
3 3
5 1
2 1


Output

20

Note

In the first sample there are exactly two variants of arranging a beautiful fence of length 3: 

  * As the first fence board use the board of the first type of length 1 and width 2. As the second board use board of the second type of length 2 and width 3. 
  * Use one board of the second type after you turn it. That makes its length equal 3, and width — 2. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const long long INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
struct point_i {
  int x, y;
  point_i(int _x = 0, int _y = 0) {
    x = _x;
    y = _y;
  }
};
struct point {
  double x, y;
  point(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const point &other) const {
    if (fabs(x - other.x) < eps) return y < other.y;
    return x < other.x;
  }
};
struct line_s {
  point beg, end;
  line_s() {
    beg = point(0, 0);
    end = point(0, 0);
  }
  line_s(point a, point b) : beg(a), end(b) {}
  bool intersect(const line_s &other, point &ans) {
    double mua, mub;
    double denom, numera, numerb;
    denom = (other.end.y - other.beg.y) * (end.x - beg.x) -
            (other.end.x - other.beg.x) * (end.y - beg.y);
    numera = (other.end.x - other.beg.x) * (beg.y - other.beg.y) -
             (other.end.y - other.beg.y) * (beg.x - other.beg.x);
    numerb = (end.x - beg.x) * (beg.y - other.beg.y) -
             (end.y - beg.y) * (beg.x - other.beg.x);
    if (denom == 0 && numera == 0 && numerb == 0) return 0;
    mua = numera / denom;
    mub = numerb / denom;
    if (mua < 0 || mua > 1 || mub < 0 || mub > 1) {
      ans.x = 0;
      ans.y = 0;
      return 0;
    }
    ans.x = beg.x + mua * (end.x - beg.x);
    ans.y = beg.y + mua * (end.y - beg.y);
    return 1;
  }
};
struct line {
  double a, b, c, len;
  line() { a = b = c = 0.0; }
  line(const point &a_, const point &b_) {
    if (fabs(a_.x - b_.x) < eps) {
      a = 1.0;
      b = 0.0;
      c = -a_.x;
    } else {
      a = -(double)(a_.y - b_.y) / (a_.x - b_.x);
      b = 1.0;
      c = -(double)(a_.x * a) - (double)(a_.y * b);
    }
    if (fabs(a) < eps) a = fabs(a);
    if (fabs(b) < eps) b = fabs(b);
    if (fabs(c) < eps) c = fabs(c);
    double x = a_.x - b_.x, y = a_.y - b_.y;
    len = sqrt((x * x) + (y * y));
  }
  bool parallel(const line &other) {
    return (fabs(a - other.a) < eps && fabs(b - other.b) < eps);
  }
  bool same(const line &other) {
    return (*this).parallel(other) && fabs(c - other.c) < eps;
  }
};
int dp[3002][102][102];
int n, LEN, a, b;
const int MOD = 1000000007;
vector<pair<int, int> > vc[2];
int main() {
  scanf("%d%d", &n, &LEN);
  vc[0].push_back(make_pair(-1, -1));
  vc[1].push_back(make_pair(-1, -1));
  for (int(i) = (0), _t = (n); i < (_t); ++(i)) {
    scanf("%d%d", &a, &b);
    vc[0].push_back(make_pair(a, b));
    vc[1].push_back(make_pair(b, a));
  }
  for (int(j) = (0), _t = (100); j <= (_t); ++(j)) dp[0][0][j] = 1;
  for (int(i) = (1), _t = (LEN); i <= (_t); ++(i))
    for (int(j) = (1), _t = (n); j <= (_t); ++(j)) {
      if (i - (((vc[0][j].first) < (vc[0][j].second)) ? (vc[0][j].first)
                                                      : (vc[0][j].second)) <
          0)
        continue;
      for (int(k) = (0), _t = (n); k <= (_t); ++(k)) {
        if (j == k) continue;
        if (i - vc[0][j].first < 0 || (i - vc[0][j].first > 0 && k == 0))
          ;
        else {
          dp[i][j][vc[0][j].second] +=
              dp[i - vc[0][j].first][k][vc[0][j].first];
          dp[i][j][vc[0][j].second] %= MOD;
        }
        if (vc[0][j] != vc[1][j])
          if (i - vc[1][j].first < 0 || (i - vc[1][j].first > 0 && k == 0))
            ;
          else {
            dp[i][j][vc[1][j].second] +=
                dp[i - vc[1][j].first][k][vc[1][j].first];
            dp[i][j][vc[1][j].second] %= MOD;
          }
      }
    }
  int ans = 0;
  for (int(i) = (0), _t = (101); i < (_t); ++(i))
    for (int(j) = (0), _t = (101); j < (_t); ++(j)) {
      ans += dp[LEN][i][j];
      ans %= MOD;
    }
  cout << ans << endl;
  return 0;
}