#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
struct edge {
  long long to;
  long long cost;
};
vector<edge> mp[maxn];
long long dis[maxn];
long long vis[maxn];
long long dis1[maxn];
long long a[maxn];
long long b[maxn];
long long N, M, k;
long long cot[maxn];
bool SPFA(long long s, long long N) {
  memset(vis, 0, sizeof(vis));
  memset(cot, 0, sizeof(cot));
  for (int i = 0; i <= N; i++) {
    dis[i] = 1000000000000000000;
    ;
  }
  priority_queue<long long> q;
  dis[s] = 0;
  q.push(s);
  while (!q.empty()) {
    int u = q.top();
    q.pop();
    vis[u] = 0;
    for (int v = 0; v < mp[u].size(); v++) {
      int to = mp[u][v].to;
      if (dis[u] + mp[u][v].cost < dis[to]) {
        dis[to] = dis[u] + mp[u][v].cost;
        if (!vis[to]) {
          vis[to] = 1;
          q.push(to);
        }
      } else if (dis[to] == dis[u] + mp[u][v].cost) {
        cot[to]++;
      }
    }
  }
  return true;
}
int main() {
  long long u, v, cost;
  scanf("%lld %lld %lld", &N, &M, &k);
  memset(mp, 0, sizeof(mp));
  for (int i = 0; i < M; i++) {
    scanf("%lld%lld%lld", &u, &v, &cost);
    edge te;
    te.to = v;
    te.cost = cost;
    mp[u].push_back(te);
    te.to = u;
    te.cost = cost;
    mp[v].push_back(te);
  }
  long long sum = 0;
  for (int i = 0; i < k; i++) {
    scanf("%lld %lld", &a[i], &b[i]);
    edge te;
    te.to = a[i];
    te.cost = b[i];
    mp[1].push_back(te);
    te.to = 1;
    te.cost = b[i];
    mp[a[i]].push_back(te);
  }
  SPFA(1, N);
  for (int i = 0; i < k; i++) {
    if (dis[a[i]] < b[i]) {
      sum++;
    } else if ((dis[a[i]] == b[i])) {
      if (cot[a[i]] >= 1) {
        sum++;
        cot[a[i]]--;
      }
    }
  }
  printf("%lld\n", sum);
}
