#include <bits/stdc++.h>
using namespace std;
long long dis[2123456];
int ans = 0;
long long n;
vector<pair<long long, long long> > v[2123456];
int main() {
  ios::sync_with_stdio(false);
  long long m, k;
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &k);
  for (int i = 0; i < m; i++) {
    long long u, vv, x;
    scanf("%lld", &u);
    scanf("%lld", &vv);
    scanf("%lld", &x);
    v[u].push_back(make_pair(vv, 2 * x));
    v[vv].push_back(make_pair(u, 2 * x));
  }
  for (int i = 0; i < k; i++) {
    long long u = 1;
    long long vv;
    long long x;
    scanf("%lld", &vv);
    scanf("%lld", &x);
    v[vv].push_back(make_pair(u, -2 * x));
    v[u].push_back(make_pair(vv, -2 * x));
  }
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  for (int i = 0; i <= n; i++) dis[i] = 1ll << 60;
  int root = 1;
  q.push(make_pair(0, root));
  dis[root] = 0;
  while (!q.empty()) {
    pair<long long, long long> temp = q.top();
    q.pop();
    long long t1 = temp.first;
    long long t2 = temp.second;
    if (dis[t2] == t1) {
      if (t1 % 2) {
        ans++;
        t1--;
      }
      int l = v[t2].size();
      for (int i = 0; i < l; i++) {
        long long tmp1 = v[t2][i].first;
        long long tmp2 = v[t2][i].second;
        if (tmp2 < 0) {
          tmp2 = -tmp2 + 1;
        }
        if (dis[tmp1] > tmp2 + t1) {
          dis[tmp1] = tmp2 + t1;
          q.push(make_pair(dis[tmp1], tmp1));
        }
      }
    }
  }
  cout << k - ans << endl;
  return 0;
}
