#include <bits/stdc++.h>
using namespace std;
long long nx2(long long n) {
  long long p = 1;
  if (n && !(n & (n - 1))) return n;
  while (p < n) p <<= 1;
  return p;
}
namespace Debug {
void dout() { cerr << "\n"; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << " " << H;
  dout(T...);
}
template <typename T>
void douta(const T *a, int n) {
  cerr << "\n[";
  for (int i = 0; i < n; i++) {
    cerr << " " << a[i];
  }
  cerr << " ]\n";
}
template <typename T>
void doutaa(T **b, int r, int c) {
  for (int i = 0; i < r; i++) {
    cerr << "[";
    for (int j = 0; j < c; j++) {
      cerr << " " << b[i][j];
    }
    cerr << " ]\n";
  }
}
template <typename T>
void dout(const vector<T> v) {
  cerr << "\n[";
  for (T i : v) {
    cerr << " " << i;
  }
  cerr << " ]\n";
}
template <typename T>
void dout(const vector<vector<T>> v) {
  cerr << "\n";
  for (vector<T> u : v) {
    cerr << "[";
    for (T i : u) {
      cerr << " " << i;
    }
    cerr << " ]\n";
  }
}
template <typename F, typename S>
void dout(const vector<pair<F, S>> u) {
  cerr << "\n";
  for (pair<F, S> v : u) {
    cerr << "[ " << v.first << " " << v.second << " ]\n";
  }
}
}  // namespace Debug
using namespace Debug;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<vector<vector<long long>>> adj(n);
  vector<long long> si(k);
  for (long long i = 0; i < m + k; i++) {
    if (i < m) {
      long long u, v, x;
      cin >> u >> v >> x, --u, --v;
      adj[u].push_back({v, x, i});
      adj[v].push_back({u, x, i});
    } else {
      long long s, y;
      cin >> s >> y, --s;
      si[i - m] = s;
      adj[0].push_back({s, y, i});
      adj[s].push_back({0, y, i});
    }
  }
  vector<long long> vis(n), vis1(n), dist(n, INT_MAX);
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  dist[0] = 0;
  pq.push({dist[0], 0});
  vis[0] = 0;
  while (!pq.empty()) {
    long long u = pq.top().second;
    pq.pop();
    if (vis1[u]) {
      continue;
    }
    vis1[u] = 1;
    for (auto vwi : adj[u]) {
      long long v = vwi[0], w = vwi[1], i = vwi[2];
      if (v == 0) {
        continue;
      }
      if (dist[v] > dist[u] + w) {
        vis[v] = i;
        dist[v] = dist[u] + w;
        pq.push({dist[v], v});
      } else if (dist[v] == dist[u] + w && vis[v] >= m && i < m) {
        vis[v] = i;
        pq.push({dist[v], v});
      }
    }
  }
  long long res = 0;
  for (long long i = 0; i < k; i++) {
    res += (vis[si[i]] != i + m);
  }
  cout << res << '\n';
}
