#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const double EPS = 1e-9;
const int N = 2e5 + 9;
int n, m, k, vis[N], ans;
long long dis[N];
vector<pair<pair<long long, long long>, int>> a[N];
pair<int, int> s[N];
void dk() {
  priority_queue<pair<pair<long long, long long>, int>> q;
  q.push({{0, 1}, 1});
  while (!q.empty()) {
    int u = q.top().second;
    long long d = -q.top().first.first;
    long long t = q.top().first.second;
    q.pop();
    if (vis[u]) continue;
    dis[u] = d;
    vis[u] = 1;
    if (!t) ans++;
    for (auto p : a[u]) {
      int v = p.second;
      long long ds = p.first.second;
      long long tt = p.first.first;
      q.push({{-d - ds, tt}, v});
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  int u, v, x;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v >> x;
    a[u].push_back({{1, x}, v});
    a[v].push_back({{1, x}, u});
  }
  for (int i = 1; i <= k; i++) {
    cin >> v >> x;
    a[1].push_back({{0, x}, v});
    a[v].push_back({{0, x}, 1});
  }
  dk();
  cout << k - ans;
  return 0;
}
