#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long d[N];
vector<pair<int, int> > adj[N];
long long s[N];
int parent[N];
bool mark[N];
int main() {
  int n, m, k;
  int cnt = 1;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  scanf("%d", &k);
  ;
  int save = m;
  int save2 = k;
  while (m--) {
    int x, y;
    long long w;
    scanf("%d", &x);
    ;
    scanf("%d", &y);
    ;
    scanf("%lld", &w);
    ;
    adj[x].push_back(make_pair(y, cnt));
    adj[y].push_back(make_pair(x, cnt));
    s[cnt++] = w;
  }
  while (k--) {
    int x;
    scanf("%d", &x);
    ;
    long long y;
    scanf("%lld", &y);
    ;
    adj[1].push_back(make_pair(x, cnt));
    adj[x].push_back(make_pair(1, cnt));
    s[cnt++] = y;
  }
  fill(d, d + n + 2, 100000000000000000LL);
  d[1] = 0;
  priority_queue<pair<long long, int> > q;
  q.push(make_pair(0, 1));
  memset(parent, -1, sizeof(parent));
  while (!q.empty()) {
    int node = q.top().second;
    long long dist = -q.top().first;
    q.pop();
    if (dist > d[node]) continue;
    for (int i = 0; i < adj[node].size(); i++) {
      int v = adj[node][i].second;
      int p = adj[node][i].first;
      if (dist + s[v] < d[p]) {
        parent[p] = v;
        d[p] = dist + s[v];
        q.push(make_pair(-d[p], p));
      } else if (d[p] == dist + s[v]) {
        if (v <= save) {
          parent[p] = v;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (parent[i] != -1) {
      mark[parent[i]] = 1;
    }
  }
  int ans = 0;
  for (int i = save + 1; i <= save + save2; i++) {
    if (!mark[i]) ans++;
  }
  cout << ans << endl;
}
