#include <bits/stdc++.h>
using namespace std;
using namespace std;
const long long MAXN = 1e5 + 7;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
const long long mod = 1e4 + 7;
struct node {
  int v;
  int w;
  int next;
} edge[MAXN * 10];
int head[MAXN], dis[MAXN];
int n, m, num, now, k;
struct node1 {
  int x, len;
  friend bool operator<(node1 n1, node1 n2) { return n1.len > n2.len; }
};
struct node2 {
  int v, w;
} pos[MAXN];
void add(int u, int v, int w) {
  edge[num].v = v;
  edge[num].w = w;
  edge[num].next = head[u];
  head[u] = num++;
}
void Init() {
  num = 1;
  for (int i = 1; i <= n; i++) {
    head[i] = 0;
    dis[i] = INF;
  }
}
int judge[MAXN];
void dij() {
  node1 u;
  u.x = 1;
  u.len = 0;
  dis[1] = 0;
  priority_queue<node1> Q;
  Q.push(u);
  while (!Q.empty()) {
    u = Q.top();
    Q.pop();
    int x = u.x, len = u.len;
    if (dis[x] < len) continue;
    for (int i = head[x]; i; i = edge[i].next) {
      int k = edge[i].v;
      if (dis[k] > dis[x] + edge[i].w) {
        judge[k] = 1;
        dis[k] = dis[x] + edge[i].w;
        u.x = k;
        u.len = dis[k];
        Q.push(u);
      } else if (dis[k] == dis[x] + edge[i].w) {
        judge[k]++;
      }
    }
  }
}
int main(int argc, char const *argv[]) {
  cin >> n >> m >> k;
  Init();
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    add(u, v, w);
    add(v, u, w);
  }
  for (int i = 1; i <= k; i++) {
    cin >> pos[i].v >> pos[i].w;
    add(1, pos[i].v, pos[i].w);
  }
  dij();
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    if (dis[pos[i].v] == pos[i].w && judge[pos[i].v] > 1) {
      judge[pos[i].v]--;
      ans++;
    } else if (dis[pos[i].v] < pos[i].w)
      ans++;
  }
  cout << ans << endl;
  return 0;
}
