#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
clock_t time_p = clock();
void aryanc403() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long int INF = 0xFFFFFFFFFFFFFFFL;
long long int seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline long long int rnd(long long int l = 0, long long int r = INF) {
  return uniform_int_distribution<long long int>(l, r)(rng);
}
class CMP {
 public:
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    return !(a.second < b.second ||
             (a.second == b.second && a.first >= b.first));
  }
};
void add(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt == m.end())
    m.insert({x, cnt});
  else
    jt->second += cnt;
}
void del(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt->second <= cnt)
    m.erase(jt);
  else
    jt->second -= cnt;
}
bool cmp(const pair<long long int, long long int> &a,
         const pair<long long int, long long int> &b) {
  return a.first < b.first || (a.first == b.first && a.second < b.second);
}
const long long int mod = 1000000007L;
const long long int maxN = 100000L;
long long int T, n, i, j, k, in, cnt, l, r, u, v, x, y, ans;
long long int m;
string s;
vector<pair<long long int, long long int> > a, e[maxN + 5];
long long int d[maxN + 5];
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int> >, CMP>
    pq;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    cin >> n >> m >> k;
    a.clear();
    a.reserve(k);
    for (i = 0; i < (m); ++i) {
      cin >> x >> y >> in;
      e[x].push_back({y, in});
      e[y].push_back({x, in});
    }
    for (i = (1); i <= (n); ++i) d[i] = INF;
    d[1] = 0;
    for (i = 0; i < (k); ++i) {
      cin >> x >> in;
      a.push_back({x, in});
      pq.push({-x, in});
    }
    for (auto x : e[1]) pq.push({x.first, x.second});
    while (!pq.empty()) {
      auto z = pq.top();
      pq.pop();
      long long int u = abs(z.first);
      if (d[u] <= z.second) {
        ans += (z.first < 0);
        if (z.first < 0)
          ;
        continue;
      }
      d[u] = z.second;
      for (auto x : e[u]) pq.push({x.first, x.second + z.second});
    }
    cout << ans << "\n";
  }
  aryanc403();
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One can use the i-th train route to go from capital of the country to city si (and vise versa), the length of this route is yi.

Jzzhu doesn't want to waste the money of the country, so he is going to close some of the train routes. Please tell Jzzhu the maximum number of the train routes which can be closed under the following condition: the length of the shortest path from every city to the capital mustn't change.

Input

The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105).

Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109).

Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109).

It is guaranteed that there is at least one way from every city to the capital. Note, that there can be multiple roads between two cities. Also, there can be multiple routes going to the same city from the capital.

Output

Output a single integer representing the maximum number of the train routes which can be closed.

Examples

Input

5 5 3
1 2 1
2 3 2
1 3 3
3 4 4
1 5 5
3 5
4 5
5 5


Output

2


Input

2 2 3
1 2 2
2 1 3
2 1
2 2
2 3


Output

2

### Response

```cpp
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
clock_t time_p = clock();
void aryanc403() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long int INF = 0xFFFFFFFFFFFFFFFL;
long long int seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline long long int rnd(long long int l = 0, long long int r = INF) {
  return uniform_int_distribution<long long int>(l, r)(rng);
}
class CMP {
 public:
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    return !(a.second < b.second ||
             (a.second == b.second && a.first >= b.first));
  }
};
void add(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt == m.end())
    m.insert({x, cnt});
  else
    jt->second += cnt;
}
void del(map<long long int, long long int> &m, long long int x,
         long long int cnt = 1) {
  auto jt = m.find(x);
  if (jt->second <= cnt)
    m.erase(jt);
  else
    jt->second -= cnt;
}
bool cmp(const pair<long long int, long long int> &a,
         const pair<long long int, long long int> &b) {
  return a.first < b.first || (a.first == b.first && a.second < b.second);
}
const long long int mod = 1000000007L;
const long long int maxN = 100000L;
long long int T, n, i, j, k, in, cnt, l, r, u, v, x, y, ans;
long long int m;
string s;
vector<pair<long long int, long long int> > a, e[maxN + 5];
long long int d[maxN + 5];
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int> >, CMP>
    pq;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    cin >> n >> m >> k;
    a.clear();
    a.reserve(k);
    for (i = 0; i < (m); ++i) {
      cin >> x >> y >> in;
      e[x].push_back({y, in});
      e[y].push_back({x, in});
    }
    for (i = (1); i <= (n); ++i) d[i] = INF;
    d[1] = 0;
    for (i = 0; i < (k); ++i) {
      cin >> x >> in;
      a.push_back({x, in});
      pq.push({-x, in});
    }
    for (auto x : e[1]) pq.push({x.first, x.second});
    while (!pq.empty()) {
      auto z = pq.top();
      pq.pop();
      long long int u = abs(z.first);
      if (d[u] <= z.second) {
        ans += (z.first < 0);
        if (z.first < 0)
          ;
        continue;
      }
      d[u] = z.second;
      for (auto x : e[u]) pq.push({x.first, x.second + z.second});
    }
    cout << ans << "\n";
  }
  aryanc403();
  return 0;
}

```