The fundamental prerequisite for justice is not to be correct, but to be strong. That's why justice is always the victor.

The Cinderswarm Bee. Koyomi knows it.

The bees, according to their nature, live in a tree. To be more specific, a complete binary tree with n nodes numbered from 1 to n. The node numbered 1 is the root, and the parent of the i-th (2 ≤ i ≤ n) node is <image>. Note that, however, all edges in the tree are undirected.

Koyomi adds m extra undirected edges to the tree, creating more complication to trick the bees. And you're here to count the number of simple paths in the resulting graph, modulo 109 + 7. A simple path is an alternating sequence of adjacent nodes and undirected edges, which begins and ends with nodes and does not contain any node more than once. Do note that a single node is also considered a valid simple path under this definition. Please refer to the examples and notes below for instances.

Input

The first line of input contains two space-separated integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 4) — the number of nodes in the tree and the number of extra edges respectively.

The following m lines each contains two space-separated integers u and v (1 ≤ u, v ≤ n, u ≠ v) — describing an undirected extra edge whose endpoints are u and v.

Note that there may be multiple edges between nodes in the resulting graph.

Output

Output one integer — the number of simple paths in the resulting graph, modulo 109 + 7.

Examples

Input

3 0


Output

9


Input

3 1
2 3


Output

15


Input

2 4
1 2
2 1
1 2
2 1


Output

12

Note

In the first example, the paths are: (1); (2); (3); (1, 2); (2, 1); (1, 3); (3, 1); (2, 1, 3); (3, 1, 2). (For the sake of clarity, the edges between nodes are omitted since there are no multiple edges in this case.)

In the second example, the paths are: (1); (1, 2); (1, 2, 3); (1, 3); (1, 3, 2); and similarly for paths starting with 2 and 3. (5 × 3 = 15 paths in total.)

In the third example, the paths are: (1); (2); any undirected edge connecting the two nodes travelled in either direction. (2 + 5 × 2 = 12 paths in total.)
#include <bits/stdc++.h>
using namespace std;
const int p = 1000000007;
map<int, int> M;
int g[500], h[500], u[10], v[10], x[500], y[500];
bool b[500], z[10];
int i, j, k, m, n, s, w;
inline int getsize(int x) {
  int l = x, r = x, t = 0;
  for (; l <= n; l = l << 1, r = min(r << 1 | 1, n)) t = t + r - l + 1;
  return t;
}
inline bool go(int u, int v, bool c) {
  int x, y;
  x = u, y = v;
  bool d = true;
  while (x != y) {
    if (x < y) swap(x, y);
    d = d && (c != b[M[x]]);
    x = x >> 1;
  }
  d = d && (c != b[M[x]]);
  if (!d) return d;
  x = u, y = v;
  while (x != y) {
    if (x < y) swap(x, y);
    b[M[x]] = c;
    x = x >> 1;
  }
  b[M[x]] = c;
  return d;
}
inline void dfsV(int x, int y) {
  if (!M[x]) return;
  if (b[M[x]]) return;
  b[M[x]] = true;
  s = (s + 1LL * h[M[x]] * y) % p;
  dfsV(x >> 1, y);
  dfsV(x << 1, y);
  dfsV(x << 1 | 1, y);
  b[M[x]] = false;
  return;
}
inline void dfsU(int x, int y) {
  if (!M[x]) return;
  if (b[M[x]]) return;
  b[M[x]] = true;
  dfsV(v[w], y * h[M[x]]);
  dfsU(x >> 1, y);
  dfsU(x << 1, y);
  dfsU(x << 1 | 1, y);
  b[M[x]] = false;
  return;
}
inline void dfs(int o) {
  if (o > 1) dfsU(u[1], 1);
  w++;
  for (int i = 1; i <= m; i++)
    if (!z[i]) {
      z[i] = true;
      u[w] = x[i], v[w] = y[i];
      if ((o == 1) || (go(v[w - 1], u[w], true))) {
        dfs(o + 1);
        if (o > 1) go(v[w - 1], u[w], false);
      }
      u[w] = y[i], v[w] = x[i];
      if ((o == 1) || (go(v[w - 1], u[w], true))) {
        dfs(o + 1);
        if (o > 1) go(v[w - 1], u[w], false);
      }
      z[i] = false;
    }
  w--;
  return;
}
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x[i], &y[i]);
    for (j = x[i]; j; j = j >> 1)
      if (!M[j]) k++, g[k] = j, M[j] = k;
    for (j = y[i]; j; j = j >> 1)
      if (!M[j]) k++, g[k] = j, M[j] = k;
  }
  for (i = 1; i <= k; i++) {
    h[i] = getsize(g[i]);
    if (M[g[i] << 1]) h[i] = h[i] - getsize(g[i] << 1);
    if (M[g[i] << 1 | 1]) h[i] = h[i] - getsize(g[i] << 1 | 1);
  }
  s = 1LL * n * n % p;
  dfs(1);
  printf("%d", s);
  return 0;
}
