Problem: <image>

After William is done with work for the day, he enjoys playing his favorite video game.

The game happens in a 2D world, starting at turn 0. William can pick any cell in the game world and spawn in it. Then, each turn, William may remain at his current location or move from the current location (x, y) to one of the following locations: (x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1).

To accelerate movement the game has n fast travel towers. i-th tower is located at location (xa_i, ya_i). To be able to instantly travel to the tower from any location in the game world it must first be activated. Activation of tower i happens at the moment when the player is in cell (xa_i, ya_i) after this the tower remains active throughout the entire game.

William also knows that the game has m quests. i-th quest can be completed instantly by being at location (xb_i, yb_i) on turn t_i.

William wants to find out the maximal number of quests he will be able to complete by optimally traversing the game world.

Input

The first line contains two integers n and m (0 ≤ n ≤ 14, 1 ≤ m ≤ 100), which are the number of towers and the number of quests, respectively.

Each of the next n lines contains two integers xa_i, ya_i (1 ≤ xa_i, ya_i ≤ 10^6), which are the coordinates of fast travel towers.

Each of the next m lines contains two integers xb_i, yb_i and t_i (1 ≤ xb_i, yb_i ≤ 10^6, 1 ≤ t_i ≤ 10^9), which are the coordinates of quests and the turn at which it may be completed.

It is guaranteed that all locations in a test are different.

Output

Print a single number — the maximal number of quests William will be able to complete.

Example

Input


3 4
1 1
2 3
5 2
2 2 12
5 1 4
6 2 11
3 5 10


Output


3

Note

In the first sample test one of the possible sequences of William's actions is as follows: 

  * Spawn at (3, 2) 
  * On turn 1 move to (4, 2) 
  * On turn 2 move to (5, 2). By visiting this cell William activates tower number 3. 
  * On turn 3 move to (5, 1), where he waits for 1 turn to complete the 2nd quest 
  * On turn 5 move to (5, 2) 
  * On turn 6 move to (5, 3) 
  * On turn 7 move to (5, 4) 
  * On turn 8 move to (5, 5) 
  * On turn 9 move to (4, 5) 
  * On turn 10 move to (3, 5). By moving to this location William will complete the 4th quest 
  * On turn 10 instantly move to an already activated fast travel tower at (5, 2) 
  * On turn 11 move to (6, 2). By moving to this location William will complete the 3rd quest 
  * William will not be able to complete the quest number 1, because the tower at (2, 3) was not activated 

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <fstream>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define x first
#define y second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cerr << #x << ": " << x << '\n';

#define FORI(i,a,b) for (int i = (a); i < (b); ++i)
#define FOR(i,a) FORI(i,0,a)
#define ROFI(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define ROF(i,a) ROFI(i,0,a)
#define rep(a) FOR(_,a)
#define each(a,x) for (auto& a: x)
#define FORN(i, n) FORI(i, 1, n + 1)

using vi = vector<int>;
template <typename T>
std::istream& operator >>(std::istream& input, std::pair <T, T> & data)
{
    input >> data.x >> data.y;
    return input;
}
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& data)
{
    for (T& x : data)
        input >> x;
    return input;
}
template <typename T>
std::ostream& operator <<(std::ostream& output, const pair <T, T> & data)
{
    output << "(" << data.x << "," << data.y << ")";
    return output;
}
template <typename T>
std::ostream& operator <<(std::ostream& output, const std::vector<T>& data)
{
    for (const T& x : data)
        output << x << " ";
    return output;
}
ll div_up(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll div_down(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down 
ll math_mod(ll a, ll b) { return a - b * div_down(a, b); }
#define tcT template<class T
#define tcTU tcT, class U
tcT> using V = vector<T>; 
tcT> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; 
} // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; 
}
ll gcd(ll a, ll b) {
    while (b) {
        tie(a, b) = mp(b, a % b);
    }
    return a;
}
int Bit(int mask, int bit) { return (mask >> bit) & 1; }
const int M = 103, N = 14, INF = 1e18;
int maxscore[M][1 << N], mintime[M][1 << N];
bool used[M][1 << N];

int X[N], Y[N];
int x[M], y[M], t[M];

int GO_quest[1 << N][M], GO_tower[1 << N][N];

signed main() {
    #ifdef LOCAL
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    FOR (i, M) {
        FOR (j, 1 << N) {
            maxscore[i][j] = -INF;
            mintime[i][j] = INF;
        }
    }
    FOR (i, M) {
        maxscore[i][0] = 1;
    }
    FOR (mask, 1 << N) {
        if (bp(mask) == 1) {
            mintime[0][mask] = 0;
        }
    }
    int n, m;
    cin >> n >> m;
    FOR (i, n) {
        cin >> X[i] >> Y[i];
    }

    V <vi> T;
    FOR (i, m) {
        cin >> x[i] >> y[i] >> t[i];
        T.app({t[i], x[i], y[i]});
    }

    //debug(T);

    sort(all(T));
    FOR (i, m) {
        t[i] = T[i][0];
        x[i] = T[i][1];
        y[i] = T[i][2];
    }

    FOR (mask, 1 << n) {
        FOR (i, m) {
            GO_quest[mask][i] = INF;
            FOR (j, n) {
                if (Bit(mask, j)) {
                    ckmin(GO_quest[mask][i], abs(X[j] - x[i]) + abs(Y[j] - y[i]));
                }
            }
        }
        FOR (i, n) {
            GO_tower[mask][i] = INF;
            FOR (j, n) {
                if (Bit(mask, j)) {
                    ckmin(GO_tower[mask][i], abs(X[j] - X[i]) + abs(Y[j] - Y[i]));
                }
            }
        }
    }

    FOR (i, m) {
        FOR (have, m + 1) {
            FOR (mask, 1 << n) {
                if (mintime[have][mask] <= t[i] && !used[have][mask]) {
                    used[have][mask] = 1;
                    FOR (go, n) {
                        if (!Bit(mask, go)) {
                            ckmin(mintime[have][mask + (1 << go)], mintime[have][mask] + GO_tower[mask][go]);
                        }
                    }
                    FOR (go, m) {
                        if (mintime[have][mask] + GO_quest[mask][go] <= t[go]) {
                            ckmax(maxscore[go][mask], have + 1);
                        }
                    }
                }
            }
        }
        FOR (mask, 1 << n) {
            int have = maxscore[i][mask];
            if (have > 0) {

                //debug(mp(i, mask));
                //debug(have);

                for (int j = i + 1; j < m; ++j) {
                    if (t[i] + min(GO_quest[mask][j], abs(x[i] - x[j]) + abs(y[i] - y[j])) <= t[j]) {

                        /*
                        if (i == 1 && j == 2 && mask == 3) {
                            debug("TAK");
                            debug(t[i]);
                            debug(GO_quest[mask][j]);
                            debug(t[j]);
                            exit(0);
                        }
                        */

                        ckmax(maxscore[j][mask], have + 1);
                    }
                }
                FOR (j, n) {
                    if (!Bit(mask, j)) {
                        ckmin(mintime[have][mask + (1 << j)], t[i] + min(GO_tower[mask][j], abs(x[i] - X[j]) + abs(y[i] - Y[j])));
                    }
                }

                /*
                if (maxscore[2][3] == 3) {
                    debug(mp(i, mask));
                    exit(0);
                }
                */
            }
        }
    }

    //debug(maxscore[0][0]);
    //debug(maxscore[2][0]);

    /*
    debug("sep");
    
    FOR (i, m) {
        FOR (mask, 1 << n) {
            int have = maxscore[i][mask];
            if (have > 0) {
                debug(mp(i, mask));
                debug(have);
            }
        }
    }
    */
    

    int ans = 0;
    FOR (i, m) {
        FOR (j, 1 << n) {
            ckmax(ans, maxscore[i][j]);
        }
    }
    cout << ans << endl;
}