#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v[100001];
priority_queue<pair<long long, int> > o;
int g[100001] = {0};
long long d[100001];
int main() {
  int n, m, k, i, x, y, z, ans = 0;
  cin >> n >> m >> k;
  d[0] = 0;
  for (i = 1; i < n; i++) d[i] = 1e18;
  for (i = 0; i < m; i++) {
    cin >> x >> y >> z;
    v[x - 1].push_back(make_pair(y - 1, z));
    v[y - 1].push_back(make_pair(x - 1, z));
  }
  o.push(make_pair(0, 0));
  for (i = 0; i < k; i++) {
    cin >> x >> y;
    d[x - 1] = min((long long)y, d[x - 1]);
    o.push(make_pair(-y, 1 - x));
  }
  while (!o.empty()) {
    x = o.top().second;
    long long y = -o.top().first;
    o.pop();
    if (x < 0) {
      x = -x;
      if (g[x]) ans++;
    }
    if (g[x]) continue;
    g[x] = 1;
    for (i = 0; i < v[x].size(); i++) {
      if (d[v[x][i].first] >= v[x][i].second + y) {
        d[v[x][i].first] = v[x][i].second + y;
        o.push(make_pair(-d[v[x][i].first], v[x][i].first));
      }
    }
  }
  cout << ans;
}
