#include <bits/stdc++.h>
using namespace std;
void fileio(const char* in, const char* out) {
  if (fopen(in, "r")) {
    assert(freopen(in, "r", stdin) && freopen(out, "w", stdout));
  }
}
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld EPS = 1e-9, PI = acos(-1.0L);
const int N = 2e5 + 5;
using ti = tuple<int, int, int>;
int n, m, k, ans;
vector<ti> adj[N];
ll dist[N];
bool fromTrain[N];
void dij(int s) {
  memset(dist, INF, sizeof dist);
  dist[s] = 0;
  set<pair<ll, int>> q;
  q.emplace(0, s);
  while (q.size()) {
    auto it = q.begin();
    const int u = it->second;
    const ll d = it->first;
    q.erase(it);
    if (dist[u] != d) continue;
    if (fromTrain[u]) {
      ans--;
    }
    for (auto edge : adj[u]) {
      int v, w, train;
      tie(v, w, train) = edge;
      const ll dd = d + w;
      if (dist[v] < dd) continue;
      if (dist[v] == dd && train) continue;
      dist[v] = dd;
      fromTrain[v] = train;
      q.emplace(dd, v);
    }
  }
}
int main() {
  atexit([]() { cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  cin >> n >> m >> k;
  for (int i = 0; i < (m); ++i) {
    int u, v, x;
    cin >> u >> v >> x;
    adj[u].emplace_back(v, x, 0);
    adj[v].emplace_back(u, x, 0);
  }
  for (int i = 0; i < (k); ++i) {
    const int u = 1;
    int s, y;
    cin >> s >> y;
    adj[u].emplace_back(s, y, 1);
    adj[s].emplace_back(u, y, 1);
  }
  ans = k;
  dij(1);
  for (int i = 1; i <= n; ++i) {
  }
  cout << ans << nl;
  return 0;
}
