#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool umax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
void usaco(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long double Pi = acos(-1);
const long long B = 500;
long long n, m, k, s, ans, q, res, a[N];
long long dis[N], dd[N];
long long used[N], in[N];
vector<pair<long long, long long> > edges[N];
void solve(long long t_case) {
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    edges[a].push_back({b, c});
    edges[b].push_back({a, c});
  }
  vector<long long> tt;
  for (long long i = 0; i < k; i++) {
    long long b, c;
    cin >> b >> c;
    if (used[b]) {
      umin(used[b], c), res++;
      continue;
    }
    used[b] = c;
    tt.push_back(b);
  }
  priority_queue<pair<long long, long long> > qq;
  qq.push({0, 1});
  memset(dd, 127, sizeof dd);
  dd[1] = 0;
  while (!qq.empty()) {
    pair<long long, long long> cur = qq.top();
    qq.pop();
    if (dd[cur.second] < -cur.first) continue;
    for (auto x : edges[cur.second]) {
      if (umin(dd[x.first], dd[cur.second] + x.second))
        qq.push({-dd[x.first], x.first});
    }
    if (cur.second == 1) {
      for (long long i = 1; i <= n; i++) {
        if (used[i] && umin(dd[i], dd[cur.second] + used[i]))
          qq.push({-dd[i], i});
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (auto x : edges[i]) {
      if (dd[x.first] == dd[i] + x.second) in[x.first]++;
    }
  }
  for (auto x : tt)
    if (dd[x] == used[x]) in[x]++;
  for (auto x : tt) {
    if (dd[x] < used[x])
      res++;
    else if (in[x] > 1)
      in[x]--, res++;
  }
  cout << res << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (!0) {
    solve(1);
  } else {
    long long t;
    cin >> t;
    for (long long t_case = 1; t_case <= t; t_case++) solve(t_case);
  }
  return 0;
}
