#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<pair<int, int> > G[100005];
queue<int> Q;
bool f[100005], vis[100005];
long long d[100005];
void Init() {
  while (!Q.empty()) Q.pop();
  memset(vis, 0, sizeof(vis));
  memset(d, 0x3f3f3f3f, sizeof(d));
}
void spfa() {
  Init();
  Q.push(1);
  d[1] = 0;
  vis[1] = 1;
  for (int i = 1; i <= k; i++) {
    int v, w;
    scanf("%d %d", &v, &w);
    if (w < d[v]) {
      d[v] = w;
      vis[v] = 1;
      f[v] = 1;
      Q.push(v);
    }
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    vis[u] = 0;
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i].first, w = G[u][i].second;
      if (d[u] + w <= d[v]) {
        d[v] = d[u] + w;
        f[v] = 0;
        if (!vis[v]) {
          vis[v] = 1;
          Q.push(v);
        }
      }
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    G[u].push_back(make_pair(v, w));
    G[v].push_back(make_pair(u, w));
  }
  spfa();
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (f[i]) ans++;
  printf("%d\n", k - ans);
  return 0;
}
