#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void get(T &n) {
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  n = 0;
  T s = 1;
  if (c == '-') s = -1, c = getchar();
  while (c >= '0' && c <= '9') n *= 10, n += c - '0', c = getchar();
  n *= s;
}
const long long maxn = 100010, maxm = 3 * 100010 * 2;
long long n, m, K, sp[maxn], d[maxn], ans;
struct edge {
  long long j, d;
  edge *nx;
} e[maxm], *v[maxn];
long long en;
inline void add_e(long long i, long long j, long long d) {
  e[++en].nx = v[i];
  v[i] = e + en;
  v[i]->j = j;
  v[i]->d = d;
}
bool sol[maxn];
priority_queue<pair<long long, long long> > h;
void dij(long long s, long long *sp) {
  long long i, j, k;
  while (!h.empty()) h.pop();
  for (i = 1; i <= n; i++) {
    if (i == s)
      sp[i] = 0;
    else if (d[i] >= 0)
      sp[i] = -d[i];
    else
      sp[i] = -int(~0U >> 1);
    if (sp[i] != -int(~0U >> 1)) h.push(pair<long long, long long>(sp[i], i));
    sol[i] = false;
  }
  while (!h.empty()) {
    i = h.top().second;
    h.pop();
    if (sol[i]) continue;
    sol[i] = true;
    for (edge *e = v[i]; e; e = e->nx)
      if (sp[i] - e->d > sp[e->j]) {
        sp[e->j] = sp[i] - e->d;
        h.push(pair<long long, long long>(sp[e->j], e->j));
      }
  }
  for (i = 1; i <= n; i++) sp[i] = -sp[i];
}
int main() {
  long long i, j, k, t, tt;
  get(n);
  get(m);
  get(K);
  memset(d, 255, sizeof(d));
  for (k = (1); k <= (m); k++) {
    get(i);
    get(j);
    get(t);
    add_e(i, j, t);
    add_e(j, i, t);
  }
  ans = 0;
  for (k = (1); k <= (K); k++) {
    get(i);
    get(t);
    if (d[i] == -1)
      d[i] = t;
    else {
      d[i] = min(d[i], t);
      ans++;
    }
  }
  dij(1, sp);
  for (i = (1); i <= (n); i++)
    if (d[i] >= 0) {
      for (edge *e = v[i]; e; e = e->nx)
        if (sp[e->j] + e->d <= d[i]) {
          ans++;
          break;
        }
    }
  cout << ans << "\n";
  return 0;
}
