#include <bits/stdc++.h>
using namespace std;
const int maxk = 100005;
const int maxn = 200005;
const int maxm = 300005;
const long long inf = 1e15;
int n, m, k, u[maxm], v[maxm], s[maxk], cnt[maxn];
vector<pair<long long, int> > vec[maxn];
long long w[maxm], y[maxk], d[maxn];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    que;
void dij() {
  for (int i = 1; i <= n; ++i) d[i] = inf;
  d[1] = 0;
  que.push(pair<long long, int>(0, 1));
  while (!que.empty()) {
    pair<long long, int> tp = que.top();
    que.pop();
    if (tp.first > d[tp.second]) continue;
    for (unsigned int i = 0; i < vec[tp.second].size(); ++i)
      if (d[tp.second] + vec[tp.second][i].first <
          d[vec[tp.second][i].second]) {
        d[vec[tp.second][i].second] = d[tp.second] + vec[tp.second][i].first;
        que.push(pair<long long, int>(d[tp.second] + vec[tp.second][i].first,
                                      vec[tp.second][i].second));
      }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%lld", &u[i], &v[i], &w[i]);
    vec[u[i]].push_back(pair<long long, int>(w[i], v[i]));
    vec[v[i]].push_back(pair<long long, int>(w[i], u[i]));
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d%lld", &s[i], &y[i]);
    vec[1].push_back(pair<long long, int>(y[i], s[i]));
    vec[s[i]].push_back(pair<long long, int>(y[i], 1));
  }
  dij();
  for (int i = 0; i < m; ++i) {
    if (d[u[i]] == d[v[i]] + w[i]) ++cnt[u[i]];
    if (d[v[i]] == d[u[i]] + w[i]) ++cnt[v[i]];
  }
  int res = 0;
  for (int i = 0; i < k; ++i)
    if (d[s[i]] == y[i]) ++cnt[s[i]];
  for (int i = 0; i < k; ++i)
    if (d[s[i]] == y[i] && cnt[s[i]] > 1) {
      --cnt[s[i]];
      ++res;
    } else if (d[s[i]] < y[i])
      ++res;
  printf("%d\n", res);
  return 0;
}
