#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e5 + 5, mxm = 3e5 + 5, inf = 1e18;
long long n, m, x, y, w, k;
vector<pair<int, int> > adj[mxn], train;
long long dis[mxn], ans;
bool use[mxn];
set<pair<long long, int> > S, T;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 2; i <= n; i++) {
    dis[i] = inf;
    S.insert(make_pair(inf, i));
  }
  S.insert(make_pair(0, 1));
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> w;
    adj[x].push_back(make_pair(y, w));
    adj[y].push_back(make_pair(x, w));
  }
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    train.push_back(make_pair(x, y));
  }
  for (auto q : train) {
    x = q.first;
    w = q.second;
    if (dis[x] > w) {
      S.erase(make_pair(dis[x], x));
      dis[x] = w;
      use[x] = 1;
      S.insert(make_pair(dis[x], x));
    }
  }
  int l = n;
  while (l--) {
    int v;
    long long d;
    d = S.begin()->first;
    v = S.begin()->second;
    S.erase(S.begin());
    for (auto q : adj[v]) {
      x = q.first;
      w = q.second;
      if (dis[x] >= dis[v] + 1ll * w) {
        S.erase(make_pair(dis[x], x));
        dis[x] = dis[v] + w;
        use[x] = 0;
        S.insert(make_pair(dis[x], x));
      }
    }
  }
  for (int i = 1; i <= n; i++)
    if (use[i]) k--;
  cout << k;
  return 0;
}
