#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005, maxm = 800005;
struct edge {
  int next, v, w;
  bool s;
} e[maxm];
int n, m, k, head[maxn], cnt, in[maxn], pre[maxn];
long long d[maxn];
bool vis[maxn];
void add(int u, int v, int w, bool is) {
  e[cnt] = (edge){head[u], v, w, is};
  head[u] = cnt++;
  e[cnt] = (edge){head[v], u, w, is};
  head[v] = cnt++;
}
void bfs() {
  for (int i = 1; i <= n; ++i) d[i] = -1, pre[i] = -1;
  deque<int> q;
  d[1] = 0, q.push_back(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop_front();
    vis[u] = 0;
    for (int i = head[u]; i != -1; i = e[i].next) {
      int v = e[i].v, w = e[i].w;
      long long l = d[u] + w;
      if (d[v] == -1 || l < d[v]) {
        d[v] = l;
        if (!vis[v]) {
          vis[v] = 1;
          if (!q.empty() && d[v] < d[q.front()])
            q.push_front(v);
          else
            q.push_back(v);
        }
        if (e[i].s)
          pre[v] = 0;
        else
          pre[v] = u;
      } else if (d[v] == l && !e[i].s)
        pre[v] = u;
    }
  }
}
void bfs(int x) {
  for (int i = 1; i <= n; ++i) d[i] = -1, pre[i] = -1;
  priority_queue<int> q;
  d[1] = 0, q.push(1);
  while (!q.empty()) {
    int u = q.top();
    q.pop();
    vis[u] = 0;
    for (int i = head[u]; i != -1; i = e[i].next) {
      int v = e[i].v, w = e[i].w;
      long long l = d[u] + w;
      if (d[v] == -1 || l < d[v]) {
        d[v] = l;
        if (!vis[v]) {
          vis[v] = 1;
          q.push(v);
        }
        if (e[i].s)
          pre[v] = 0;
        else
          pre[v] = u;
      } else if (d[v] == l && !e[i].s)
        pre[v] = u;
    }
  }
}
int check() {
  int tot = 0;
  for (int v = 2; v <= n; ++v) {
    if (!pre[v]) tot++;
  }
  return k - tot;
}
int main() {
  int u, v, w;
  scanf("%d%d", &n, &m);
  scanf("%d", &k);
  cnt = 0, memset(head, -1, sizeof(head));
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &u, &v);
    scanf("%d", &w);
    add(u, v, w, 0);
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d%d", &v, &w);
    add(1, v, w, 1);
    in[v]++;
  }
  bfs(0);
  printf("%d\n", check());
  return 0;
}
