#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O0")
#pragma GCC optimize("O1")
long long pw(int a, int b) {
  long long ret = 1;
  long long mul = a;
  while (b > 0) {
    if (b & 1) ret *= mul;
    mul *= mul;
    b /= 2;
  }
  return ret;
}
long long to_int(string s) {
  long long ret = 0;
  for (int(i) = (0); (i) < (s.size()); (i)++) {
    ret += pw(10, s.size() - i - 1) * (long long)(s[i] - '0');
  }
  return ret;
}
const int MAXN = 3e5 + 35;
int n, m, k, st[MAXN];
long long dis[MAXN];
vector<pair<int, int> > adj[MAXN];
bool mark[MAXN];
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> n >> m >> k;
  memset(st, -1, sizeof st);
  for (int(i) = (0); (i) < (n); (i)++) dis[i] = 2e17;
  for (int(i) = (0); (i) < (m); (i)++) {
    int s, e, x;
    cin >> s >> e >> x;
    s--, e--;
    adj[s].push_back({e, x}), adj[e].push_back({s, x});
  }
  for (int(i) = (0); (i) < (k); (i)++) {
    int s, y;
    cin >> s >> y;
    s--;
    if (dis[s] < y)
      mark[i] = 1;
    else {
      if (st[s] != -1) mark[st[s]] = 1;
      st[s] = i;
      if (dis[s] != y) pq.push({y, s});
      dis[s] = y;
    }
  }
  dis[0] = 0, pq.push({0, 0});
  while (pq.size()) {
    int v = pq.top().second;
    long long dv = pq.top().first;
    pq.pop();
    if (dis[v] != dv) continue;
    for (int(i) = (0); (i) < (adj[v].size()); (i)++) {
      int u = adj[v][i].first, cost = adj[v][i].second;
      if (dis[u] >= dv + cost and st[u] != -1) mark[st[u]] = 1;
      if (dis[u] > dv + cost) {
        dis[u] = dv + cost;
        pq.push({dis[u], u});
      }
    }
  }
  int ans = 0;
  for (int(i) = (0); (i) < (k); (i)++) ans += mark[i];
  cout << ans << "\n";
}
