#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
const long long OO = 1LL * 1000000 * 1000000 * 1000000;
int n, m, K;
vector<vector<pair<int, int> > > G;
const int MAXN = 3 * 100000 + 9;
pair<int, int> train[MAXN];
long long SP[MAXN];
bool usin[MAXN];
void dijkstra() {
  for (int i = 0; i < n; i++) {
    SP[i] = OO;
    usin[i] = false;
  }
  priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                 greater<pair<long long, int> > >
      PQ;
  PQ.push(make_pair(0, 0));
  SP[0] = 0;
  for (int i = 0; i < K; i++) {
    int v = train[i].first;
    int w = train[i].second;
    if (SP[v] > w) {
      SP[v] = w;
      usin[v] = true;
      PQ.push(make_pair(SP[v], v));
    }
  }
  while (!PQ.empty()) {
    pair<long long, int> top = PQ.top();
    PQ.pop();
    int u = top.second;
    long long d = top.first;
    if (d > SP[u]) continue;
    for (int i = 0, sz = G[u].size(); i < sz; i++) {
      int v = G[u][i].first;
      int w = G[u][i].second;
      long long nw = SP[u] + w;
      if (nw > SP[v]) continue;
      if (nw == SP[v]) {
        usin[v] = false;
        continue;
      }
      SP[v] = nw;
      usin[v] = false;
      PQ.push(make_pair(SP[v], v));
    }
  }
}
int main() {
  read_file();
  while (scanf("%d %d %d", &n, &m, &K) != -1) {
    G.assign(n, vector<pair<int, int> >());
    for (int i = 0; i < m; i++) {
      int u, v, w;
      scanf("%d %d %d", &u, &v, &w);
      u--, v--;
      G[u].push_back(make_pair(v, w));
      G[v].push_back(make_pair(u, w));
    }
    for (int i = 0; i < K; i++) {
      scanf("%d %d", &train[i].first, &train[i].second);
      train[i].first--;
    }
    dijkstra();
    int ans = K;
    for (int i = 0; i < n; i++)
      if (usin[i]) ans--;
    printf("%d\n", ans);
  }
}
