#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const long long inf = 1LL << 60;
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const int N = 100100;
priority_queue<pair<long long, int>, vector<pair<long long, int>>,
               greater<pair<long long, int>>>
    pq;
vector<pair<int, pair<int, int>>> adj[N];
bool trn[N];
long long dis[N];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    int u, v, c;
    scanf("%d%d%d", &u, &v, &c);
    int t = 0;
    adj[u].push_back({v, {c, t}});
    adj[v].push_back({u, {c, t}});
  }
  for (int i = 0; i < k; i++) {
    int u = 1;
    int v, c;
    scanf("%d%d", &v, &c);
    int t = 1;
    adj[u].push_back({v, {c, t}});
  }
  for (int i = 1; i <= n; i++) dis[i] = inf;
  dis[1] = 0;
  pq.push({0, 1});
  while (pq.size()) {
    int u = pq.top().second;
    long long c = pq.top().first;
    pq.pop();
    if (dis[u] != c) continue;
    for (auto p : adj[u]) {
      int v = p.first;
      int w = p.second.first, t = p.second.second;
      if (dis[u] + w < dis[v]) {
        if (t)
          trn[v] = 1;
        else
          trn[v] = 0;
        dis[v] = dis[u] + w;
        pq.push({dis[v], v});
      }
      if (dis[u] + w == dis[v] && !t) trn[v] = 0;
    }
  }
  int ans = k;
  for (int i = 1; i <= n; i++)
    if (trn[i]) ans--;
  printf("%d", ans);
}
