#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct my {
  int first, z, second;
};
struct cmp {
  bool operator()(const my a, const my b) {
    return (a.second < b.second) ||
           (a.second == b.second && a.first < b.first) ||
           (a.second == b.second && a.first == b.first && a.z < b.z);
  }
};
vector<my> a[N];
my mp(int first, int second, int z) {
  my a;
  a.first = first;
  a.second = second;
  a.z = z;
  return a;
}
int n, m, k, first, second, z, ans;
long long d[N][2];
set<my, cmp> s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    cin >> first >> second >> z;
    first--, second--;
    a[first].push_back(mp(second, z, 0));
    a[second].push_back(mp(first, z, 0));
  }
  for (int i = 0; i < k; i++) {
    cin >> first >> second;
    first--;
    a[0].push_back(mp(first, second, 1));
    a[first].push_back(mp(0, second, 1));
  }
  ans = k;
  for (int i = 0; i < n; i++) d[i][0] = d[i][1] = (long long)1e18;
  d[0][0] = 0;
  s.insert(mp(0, 0, 0));
  while (!s.empty()) {
    int v = (*s.begin()).first;
    int e = (*s.begin()).z;
    s.erase(s.begin());
    for (int i = 0; i < a[v].size(); i++) {
      int to = a[v][i].first, len = a[v][i].second, type = a[v][i].z;
      if (d[to][type] > d[v][e] + len) {
        s.erase(mp(to, d[to][type], type));
        d[to][type] = d[v][e] + len;
        s.insert(mp(to, d[to][type], type));
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (d[i][0] > d[i][1]) ans--;
  cout << ans;
  return 0;
}
