#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m, k, u, v, w, e[100005] = {}, z = 0;
  long long int d[100005] = {}, h[100005] = {};
  bool b[100005] = {};
  vector<pair<int, int>> g[100005] = {};
  cin >> n >> m >> k;
  for (int i = 1; i <= n - 1; i++)
    d[i + 1] = (long long int)1000000007 * 1000000007,
          h[i + 1] = (long long int)1000000007 * 1000000007;
  for (int i = 0; i < m; i++)
    cin >> u >> v >> w, g[u].push_back({v, w}), g[v].push_back({u, w});
  for (int i = 0; i < k; i++) cin >> v >> w, h[v] = min(h[v], (long long int)w);
  for (int i = 2; i <= n; i++)
    if (h[i] != (long long int)1000000007 * 1000000007)
      g[1].push_back({i, h[i]}), g[i].push_back({1, h[i]});
  priority_queue<pair<long long int, int>, vector<pair<long long int, int>>,
                 greater<pair<long long int, int>>>
      q;
  q.push({0ll, 1});
  while (!q.empty()) {
    int x = q.top().second;
    q.pop();
    if (b[x]) continue;
    b[x] = 1;
    for (pair<int, int> i : g[x]) {
      if (d[x] + i.second < d[i.first]) {
        d[i.first] = d[x] + i.second;
        q.push({d[i.first], i.first});
      }
    }
  }
  for (int i = 1; i <= n; i++)
    for (pair<int, int> j : g[i])
      if (d[i] + j.second == d[j.first]) e[j.first]++;
  for (int i = 1; i <= n; i++)
    if (d[i] == h[i] && e[i] == 1) z++;
  cout << k - z;
}
