#include <bits/stdc++.h>
using namespace std;
template <typename T>
void rd(T& x) {
  x = 0;
  char ch = getchar();
  long long int f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
template <typename T, typename... Args>
void rd(T& first, Args&... args) {
  rd(first);
  rd(args...);
}
#pragma comment(linker, "/STACK:102400000,102400000")
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e5 + 7;
const int N = 3e5 + 10;
const int M = 1e5 + 10;
long long int n, m, k;
long long int a[N], b[N], c[N], dis[N], d[N], f[N];
long long int in[N];
bool vis[N];
long long int ans = 0;
struct edge {
  long long int from, to, w;
  edge() {}
  edge(long long int from, long long int to, long long int w)
      : from(from), to(to), w(w) {}
};
vector<edge> e[N];
struct node {
  long long int id, n_dis;
  node() {}
  node(long long int id, long long int n_dis) : id(id), n_dis(n_dis) {}
  bool operator<(const node& a) const { return n_dis > a.n_dis; }
};
void dij(long long int s) {
  for (long long int i = 1; i <= n; i++) dis[i] = inf, vis[i] = false;
  dis[s] = 0;
  priority_queue<node> Q;
  Q.push(node{s, dis[s]});
  while (!Q.empty()) {
    node u = Q.top();
    Q.pop();
    if (vis[u.id]) continue;
    vis[u.id] = true;
    long long int len = e[u.id].size();
    for (long long int i = 0; i < len; i++) {
      edge y = e[u.id][i];
      if (vis[y.to]) continue;
      if (dis[y.to] > y.w + u.n_dis) {
        in[y.to] = 1;
        dis[y.to] = y.w + u.n_dis;
        Q.push({y.to, dis[y.to]});
      } else if (dis[y.to] == y.w + u.n_dis) {
        in[y.to]++;
      }
    }
  }
}
vector<long long int> un[N];
int main() {
  rd(n, m, k);
  for (long long int i = 1; i <= m; i++) {
    rd(a[i], b[i], c[i]);
    e[a[i]].push_back(edge{a[i], b[i], c[i]});
    e[b[i]].push_back(edge{b[i], a[i], c[i]});
  }
  for (long long int i = 1; i <= k; ++i) {
    rd(d[i], f[i]);
    e[1].push_back(edge(1, d[i], f[i]));
  }
  dij(1);
  for (long long int i = 1; i <= k; ++i) {
    if (dis[d[i]] == f[i] && in[d[i]] > 1) {
      ans++;
      in[d[i]]--;
    }
    if (f[i] > dis[d[i]]) ans++;
  }
  printf("%lld\n", ans);
}
