#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long dis[maxn];
int head[maxn], To[maxn * 20], Len[maxn * 20], Next[maxn * 20], cnt;
int vis[maxn], x[maxn], y[maxn], in[maxn];
void add(int u, int v, int w) {
  Next[++cnt] = head[u];
  head[u] = cnt;
  To[cnt] = v;
  Len[cnt] = w;
}
int k, n, m;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int dij() {
  dis[1] = 0;
  q.push(pair<int, int>(0, 1));
  while (!q.empty()) {
    pair<int, int> tmp = q.top();
    int u = tmp.second;
    q.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    for (int i = head[u]; i != -1; i = Next[i]) {
      int v = To[i];
      int d = Len[i];
      if (dis[v] > dis[u] + d) {
        in[v] = 1;
        dis[v] = dis[u] + d;
        q.push(pair<int, int>(dis[v], v));
      } else if (dis[v] == dis[u] + d)
        in[v]++;
    }
  }
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    if (dis[x[i]] < y[i])
      ans++;
    else {
      if (dis[x[i]] == y[i] && in[x[i]] > 1) {
        in[x[i]]--;
        ans++;
      }
    }
  }
  return ans;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i <= n; i++) {
    dis[i] = 0x3f3f3f3f3f3f3f3f;
  }
  memset(head, -1, sizeof(head));
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    add(u, v, w);
    add(v, u, w);
  }
  for (int i = 1; i <= k; i++) {
    int v, w;
    scanf("%d %d", &x[i], &y[i]);
    add(1, x[i], y[i]);
    add(x[i], 1, y[i]);
  }
  cout << dij() << endl;
  return 0;
}
