#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T1, class T2>
inline void gn(T1 &x1, T2 &x2) {
  gn(x1), gn(x2);
}
template <class T1, class T2, class T3>
inline void gn(T1 &x1, T2 &x2, T3 &x3) {
  gn(x1, x2), gn(x3);
}
template <class T1, class T2, class T3, class T4>
inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {
  gn(x1, x2), gn(x3, x4);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T1, class T2>
inline void print(T1 x1, T2 x2) {
  printsp(x1), println(x2);
}
template <class T1, class T2, class T3>
inline void print(T1 x1, T2 x2, T3 x3) {
  printsp(x1), printsp(x2), println(x3);
}
template <class T1, class T2, class T3, class T4>
inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {
  printsp(x1), printsp(x2), printsp(x3), println(x4);
}
long long dis[100005], len[6 * 100005];
int nxt[6 * 100005], to[6 * 100005], head[100005];
int ans;
set<pair<long long, int> > s;
pair<long long, int> tr[100005];
void dfs(int n) {
  for (int i = 1; i <= n; i++) s.insert(pair<long long, int>(dis[i], i));
  while (!s.empty()) {
    int u = (*(s.begin())).second;
    s.erase(pair<long long, int>(dis[u], u));
    for (int edge = head[u]; edge != -1; edge = nxt[edge]) {
      int v = to[edge];
      if (dis[v] > dis[u] + len[edge]) {
        s.erase(pair<long long, int>(dis[v], v));
        dis[v] = dis[u] + len[edge];
        s.insert(pair<long long, int>(dis[v], v));
      }
    }
  }
}
int main() {
  int u, v, n, m, k, len;
  gn(n, m, k);
  int edge = 0;
  memset(head, -1, sizeof(head));
  memset(dis, 0x3f3f3f3f, sizeof(dis));
  for (int i = 0; i < m; i++) {
    gn(u, v, len);
    nxt[edge] = head[u];
    ::len[edge] = len;
    to[edge] = v;
    head[u] = edge++;
    nxt[edge] = head[v];
    ::len[edge] = len;
    to[edge] = u;
    head[v] = edge++;
  }
  for (int i = 0; i < k; i++) {
    gn(tr[i].first, tr[i].second);
    smin(dis[tr[i].first], tr[i].second);
  }
  dis[1] = 0;
  dfs(n);
  sort(tr, tr + k);
  v = 0;
  for (int i = 0; i < k; i++) {
    u = tr[i].first;
    if (u == v) {
      ans++;
      continue;
    }
    for (edge = head[u]; edge != -1; edge = nxt[edge]) {
      v = to[edge];
      if (dis[v] + ::len[edge] == dis[u]) break;
    }
    if (edge != -1) ans++;
    v = u;
  }
  println(ans);
  return 0;
}
