#include <bits/stdc++.h>
using namespace std;
struct state {
  int node;
  long long cost;
  int flag;
  state() {}
  state(int node, long long cost, int flag)
      : node(node), cost(cost), flag(flag) {}
};
bool operator<(const state& A, const state& B) {
  if (A.cost != B.cost)
    return A.cost > B.cost;
  else
    return A.flag > B.flag;
}
priority_queue<state> Q;
vector<pair<int, int> > v[1 << 18];
int n, m, K;
long long done[1 << 18];
int main() {
  scanf("%d %d %d", &n, &m, &K);
  for (int j = 1; j <= m; j++) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    v[a].push_back({b, c});
    v[b].push_back({a, c});
  }
  int ans = K;
  while (K--) {
    int x, c;
    scanf("%d %d", &x, &c);
    Q.push(state(x, c, 1));
  }
  memset(done, -1, sizeof(done));
  Q.push(state(1, 0, 0));
  while (!Q.empty()) {
    int node = Q.top().node;
    long long cost = Q.top().cost;
    int flag = Q.top().flag;
    Q.pop();
    if (done[node] != -1) continue;
    done[node] = 1;
    ans -= flag;
    for (auto pp : v[node]) {
      int nxt = pp.first;
      long long ncost = cost + pp.second;
      Q.push(state(nxt, ncost, 0));
    }
  }
  cout << ans << endl;
}
