#include <bits/stdc++.h>
using namespace std;
const long long INF = 10000000000007;
int n, m, k, x, y, z, ans;
long long d[100001];
priority_queue<pair<long long, int> > s;
vector<pair<int, pair<long long, short int> > > v[100001];
vector<pair<long long, int> > v1;
void dj() {
  for (int i = 0; i <= n; i++) d[i] = INF;
  d[1] = 0;
  s.push(make_pair(0, 1));
  while (!s.empty()) {
    int ver = s.top().second;
    if (-1 * s.top().first != d[ver]) {
      s.pop();
      continue;
    }
    s.pop();
    for (int i = 0; i < v[ver].size(); i++) {
      if (d[ver] + v[ver][i].second.first < d[v[ver][i].first]) {
        d[v[ver][i].first] = d[ver] + v[ver][i].second.first;
        s.push(make_pair(-1 * d[v[ver][i].first], v[ver][i].first));
      }
    }
  }
  return;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &x, &y, &z);
    v[x].push_back(make_pair(y, make_pair(z, 0)));
    v[y].push_back(make_pair(x, make_pair(z, 0)));
  }
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &x, &y);
    v[1].push_back(make_pair(x, make_pair(y, 1)));
    v[x].push_back(make_pair(1, make_pair(y, 1)));
  }
  dj();
  for (int i = 1; i <= n; i++) v1.push_back(make_pair(d[i], i));
  sort(v1.begin(), v1.end());
  for (int i = 1; i < v1.size(); i++) {
    bool was = false;
    for (int j = 0; j < v[v1[i].second].size(); j++) {
      if (d[v[v1[i].second][j].first] + v[v1[i].second][j].second.first ==
              d[v1[i].second] &&
          !v[v1[i].second][j].second.second) {
        was = true;
        break;
      }
    }
    if (was) continue;
    ans++;
  }
  printf("%d", k - ans);
  return 0;
}
