#include <bits/stdc++.h>
using namespace std;
struct E {
  int v, w, t;
};
const int INF = 0x3f3f3f3f, MAXN = 1e5 + 10;
int n, m, k, ans, cont, grau[MAXN], mark[MAXN];
vector<E> grafo[MAXN], cMin[MAXN];
long long dist[MAXN];
void Dijkstra() {
  dist[1] = 0;
  priority_queue<pair<long long, int> > fila;
  fila.push({-dist[1], 1});
  while (!fila.empty()) {
    int atual = fila.top().second;
    fila.pop();
    if (mark[atual]) continue;
    mark[atual] = 1;
    for (const E &p : grafo[atual]) {
      if (dist[p.v] > p.w + dist[atual]) {
        dist[p.v] = p.w + dist[atual];
        fila.push({-dist[p.v], p.v});
      }
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  E edge;
  int u, v, w;
  while (m--) {
    scanf("%d %d %d", &u, &v, &w);
    edge.v = v, edge.w = w, edge.t = 0;
    grafo[u].push_back(edge), edge.v = u;
    grafo[v].push_back(edge);
  }
  while (k--) {
    scanf("%d %d", &v, &w);
    edge.v = v, edge.w = w, edge.t = 1;
    grafo[1].push_back(edge), ans++;
  }
  memset(mark, 0, sizeof mark), memset(dist, INF, sizeof dist);
  Dijkstra();
  for (int i = 1; i <= n; i++) {
    for (const E &p : grafo[i]) {
      if (dist[p.v] == dist[i] + p.w) {
        edge.v = p.v, edge.w = p.w, edge.t = p.t;
        cMin[i].push_back(edge), grau[p.v]++;
      }
    }
  }
  for (const E &p : cMin[1]) {
    if (p.t) {
      if (grau[p.v] > 1) ans++, grau[p.v]--;
      cont++;
    }
  }
  printf("%d\n", ans - cont);
}
