#include <bits/stdc++.h>
using namespace std;
int n;
const int max_n = 100110;
vector<int> adj[max_n];
vector<bool> sign[max_n];
vector<long long> val[max_n];
long long d[max_n];
bool mark[max_n];
int p[max_n];
const long long inf = (1ll << 50);
set<pair<long long, int> > s;
void dij() {
  for (int i = 1; i <= n; i++) {
    d[i] = inf;
    if (i == 1) d[i] = 0;
    s.insert(make_pair(d[i], i));
  }
  while (s.size()) {
    int v = (*s.begin()).second;
    mark[v] = true;
    s.erase(s.begin());
    for (int i = 0; i < adj[v].size(); i++) {
      int u = adj[v][i];
      if (mark[u] == false && ((d[u] > d[v] + val[v][i]) ||
                               (d[u] == d[v] + val[v][i] && sign[v][i] == 0))) {
        s.erase(make_pair(d[u], u));
        d[u] = d[v] + val[v][i];
        p[u] = sign[v][i];
        s.insert(make_pair(d[u], u));
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    long long v, u, dis;
    cin >> u >> v >> dis;
    adj[v].push_back(u);
    adj[u].push_back(v);
    val[v].push_back(dis);
    val[u].push_back(dis);
    sign[v].push_back(0);
    sign[u].push_back(0);
  }
  for (int i = 1; i <= k; i++) {
    long long x, y;
    cin >> x >> y;
    adj[1].push_back(x);
    val[1].push_back(y);
    sign[1].push_back(1);
  }
  dij();
  for (int i = 1; i <= n; i++) mark[i] = false;
  int ans = k;
  for (int i = 1; i <= n; i++)
    if (p[i]) ans--;
  cout << ans << endl;
  return 0;
}
