#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.second < b.second)
    return true;
  else
    return false;
}
int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    int a, b, c;
    vector<pair<int, int> > v[n], t;
    for (int i = 0; i < m; i++) {
      cin >> a >> b >> c;
      a--;
      b--;
      v[a].push_back(pair<int, int>(b, c));
      v[b].push_back(pair<int, int>(a, c));
    }
    for (int i = 0; i < k; i++) {
      cin >> b >> c;
      b--;
      t.push_back(pair<int, int>(b, c));
    }
    long long d[n];
    queue<int> q;
    bool inq[n];
    for (int i = 0; i < n; i++) {
      d[i] = -1;
      inq[i] = false;
    }
    d[0] = 0;
    q.push(0);
    inq[0] = true;
    while (q.size()) {
      int x = q.front();
      q.pop();
      inq[x] = false;
      for (int i = 0; i < v[x].size(); i++) {
        if (d[v[x][i].first] == -1 ||
            d[v[x][i].first] > d[x] + v[x][i].second) {
          d[v[x][i].first] = d[x] + v[x][i].second;
          if (inq[v[x][i].first] == false) {
            inq[v[x][i].first] = true;
            q.push(v[x][i].first);
          }
        }
      }
    }
    sort(t.begin(), t.end(), cmp);
    int ANS[k];
    for (int i = 0; i < k; i++) ANS[i] = 1;
    for (int j = 0; j < k; j++) {
      if (d[t[j].first] > t[j].second) {
        ANS[j] = 0;
        d[t[j].first] = t[j].second;
        q.push(t[j].first);
        inq[t[j].first] = true;
        while (q.size()) {
          int x = q.front();
          q.pop();
          inq[t[j].first] = false;
          for (int i = 0; i < v[x].size(); i++) {
            if (d[v[x][i].first] == -1 ||
                d[v[x][i].first] > d[x] + v[x][i].second) {
              d[v[x][i].first] = d[x] + v[x][i].second;
              if (inq[v[x][i].first] == false) {
                inq[v[x][i].first] == true;
                q.push(v[x][i].first);
              }
            }
          }
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < k; i++) ans += ANS[i];
    cout << ans << endl;
  }
  return 0;
}
