#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 50;
const int INF = 1 << 30;
int n, m, k, cnt;
int head[MAXN];
struct edge {
  int v, w;
  int nxt;
  int t;
} e[MAXN << 3];
inline void add(int u, int v, int w, int tp) {
  e[cnt].v = v;
  e[cnt].w = w;
  e[cnt].nxt = head[u];
  e[cnt].t = tp;
  head[u] = cnt++;
}
bool vis[MAXN];
long long d[MAXN];
bool sign[MAXN];
int ans = 0;
void dij() {
  memset(sign, 0, sizeof sign);
  memset(d, 0x3f, sizeof d);
  memset(vis, 0, sizeof vis);
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q;
  q.push(make_pair(0, 1));
  vis[1] = 1;
  d[1] = 0;
  while (!q.empty()) {
    int u = q.top().second;
    q.pop();
    vis[u] = 0;
    for (int i = head[u]; i != -1; i = e[i].nxt) {
      edge ee = e[i];
      if (d[ee.v] > d[u] + ee.w) {
        if (e[i].t == 2) {
          if (!sign[ee.v]) {
            sign[ee.v] = 1;
            ++ans;
          }
        } else if (sign[ee.v]) {
          sign[ee.v] = 0;
          --ans;
        }
        d[ee.v] = d[u] + ee.w;
        if (!vis[ee.v]) {
          vis[ee.v] = 1;
          q.push(make_pair(d[ee.v], ee.v));
        }
      } else if (d[ee.v] == d[u] + ee.w && ee.t == 1 && sign[ee.v]) {
        sign[ee.v] = 0;
        --ans;
      }
    }
  }
}
int main() {
  cnt = 0;
  memset(head, -1, sizeof head);
  scanf("%d%d%d", &n, &m, &k);
  int u, v, w;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &u, &v, &w);
    add(u, v, w, 1);
    add(v, u, w, 1);
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d%d", &v, &w);
    add(1, v, w, 2);
  }
  dij();
  printf("%d\n", k - ans);
  return 0;
}
