#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  long long visit1[n + 1];
  long long i, j;
  vector<pair<long long, long long> > vec[n + 1];
  for (i = 1; i <= m; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    vec[x].push_back({y, z});
    vec[y].push_back({x, z});
  }
  vector<pair<long long, long long> > vec1;
  for (i = 1; i <= k; i++) {
    long long x, y;
    cin >> x >> y;
    vec1.push_back({x, y});
    vec[1].push_back({x, y});
    vec[x].push_back({1, y});
  }
  priority_queue<pair<long long, long long> > q;
  long long d[n + 1];
  for (i = 0; i <= n; i++) {
    d[i] = INT_MAX;
    visit1[i] = 0;
  }
  d[1] = 0;
  q.push({0, 1});
  while (!q.empty()) {
    long long f = q.top().first;
    long long u = q.top().second;
    q.pop();
    f = abs(f);
    if (visit1[u] == 1) continue;
    visit1[u] = 1;
    long long si = vec[u].size();
    for (i = 0; i < si; i++) {
      long long v = vec[u][i].first;
      if (visit1[v] == 1) continue;
      long long wt = vec[u][i].second;
      if (d[v] > d[u] + wt) {
        d[v] = d[u] + wt;
        q.push({-d[v], v});
      }
    }
  }
  long long in[n + 1], visit[n + 1];
  for (i = 0; i <= n; i++) in[i] = 0;
  for (i = 0; i <= n; i++) visit[i] = 0;
  for (i = 1; i <= n; i++) {
    long long si = vec[i].size();
    for (j = 0; j < si; j++) {
      long long v = vec[i][j].first;
      long long wt = vec[i][j].second;
      if (d[v] == d[i] + wt) {
        in[v]++;
        visit[v] = 1;
      }
    }
  }
  long long ans = 0;
  for (i = 0; i < k; i++) {
    long long x = vec1[i].first;
    long long y = vec1[i].second;
    if (d[x] < y) {
      ans++;
      continue;
    }
    if (in[x] > 1) {
      ans++;
      in[x]--;
      continue;
    }
    if (visit[x] == 0) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
