#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int maxn = 3e5 + 5;
const long long mod = 1e9 + 7;
const double PI = acos(-1.0);
long long po(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  } else {
    return gcd(b % a, a);
  }
}
int n, m, L, s, t, k;
int u[maxn], v[maxn], w[maxn];
long long trp[maxn], trw[maxn];
vector<pair<long long, long long> > ed[maxn];
set<pair<long long, long long> > hs;
int vis[maxn], in[maxn];
long long dis[maxn];
void dijkstra(int s, int n) {
  for (int i = 1; i <= n; i++) {
    dis[i] = 1e16 + 7;
    vis[i] = 0;
  }
  dis[s] = 0;
  for (int i = 1; i <= n; i++) {
    hs.insert(make_pair(dis[i], i));
  }
  for (int i = 1; i <= n; i++) {
    int u = hs.begin()->second;
    hs.erase(hs.begin());
    vis[u] = 1;
    for (int j = 0; j < ed[u].size(); j++) {
      int v = ed[u][j].first;
      if (dis[v] > dis[u] + ed[u][j].second) {
        in[v] = 1;
        hs.erase(make_pair(dis[v], v));
        dis[v] = dis[u] + ed[u][j].second;
        hs.insert(make_pair(dis[v], v));
      } else if (dis[v] == dis[u] + ed[u][j].second) {
        in[v]++;
      }
    }
  }
}
void solve() {
  scanf("%d", &(n)), scanf("%d", &(m)), scanf("%d", &(k));
  for (int i = 1; i <= m; i++) {
    scanf("%d", &(u[i])), scanf("%d", &(v[i])), scanf("%d", &(w[i]));
    ed[u[i]].emplace_back(make_pair(v[i], w[i]));
    ed[v[i]].emplace_back(make_pair(u[i], w[i]));
  }
  for (int i = 1; i <= k; i++) {
    scanf("%lld", &trp[i]);
    scanf("%lld", &trw[i]);
    ed[1].emplace_back(make_pair(trp[i], trw[i]));
    ed[trp[i]].emplace_back(make_pair(1, trw[i]));
  }
  dijkstra(1, n);
  int res = 0;
  for (int i = 1; i <= k; i++) {
    if (trw[i] == dis[trp[i]]) {
      if (in[trp[i]] > 1) res++, in[trp[i]]--;
    } else if (trw[i] > dis[trp[i]]) {
      res++;
    }
  }
  printf("%d\n", res);
}
int main() {
  solve();
  return 0;
}
