#include <bits/stdc++.h>
using namespace std;
inline void SetIO(string Name) {
  string In = Name + ".in", Out = Name + ".out";
  freopen(In.c_str(), "r", stdin), freopen(Out.c_str(), "w", stdout);
}
const int N = 100010, M = 600010;
int First[N], To[M], Next[M], Tot;
long long Val[M];
int n, m, k, Ans;
long long Dist[N];
pair<long long, int> Train[M];
bool Visit[M], Change[N], Vis[N];
int Which[N];
priority_queue<pair<long long, int> > Heap;
inline int Getint() {
  char Ch = ' ';
  int Ret = 0;
  while (!(Ch >= '0' && Ch <= '9')) Ch = getchar();
  while (Ch >= '0' && Ch <= '9') {
    Ret = Ret * 10 + Ch - '0';
    Ch = getchar();
  }
  return Ret;
}
inline void Insert(int x, int y, int c) {
  Tot++;
  To[Tot] = y, Val[Tot] = c, Next[Tot] = First[x];
  First[x] = Tot;
}
inline void Input() {
  n = Getint(), m = Getint(), k = Getint();
  Tot = 0;
  for (int i = (1); i <= (m); i++) {
    int x, y, c;
    x = Getint(), y = Getint(), c = Getint();
    Insert(x, y, c), Insert(y, x, c);
  }
  for (int i = (1); i <= (k); i++) {
    int x, c;
    x = Getint(), c = Getint();
    Train[i].first = c, Train[i].second = x;
  }
}
inline void Search(int x) {
  Vis[x] = 1;
  for (int Tab = First[x], v; Tab; Tab = Next[Tab])
    if (Dist[v = To[Tab]] == Dist[x] + Val[Tab]) {
      if (Vis[v]) continue;
      if (Change[v]) {
        if (Visit[Which[v]]) Ans++, Visit[Which[v]] = 0;
      }
      Search(v);
    }
}
inline void Solve() {
  sort(Train + 1, Train + 1 + k);
  for (int i = (1); i <= (k); i++) Visit[i] = 1;
  Ans = 0;
  for (int i = (1); i <= (n); i++) Dist[i] = (1000000000000000001LL);
  Dist[1] = 0;
  Heap.push(pair<long long, int>(-0, 1));
  int Finish = 1;
  while (Finish < n && !Heap.empty()) {
    pair<long long, int> T = Heap.top();
    Heap.pop();
    if (Dist[T.second] < -T.first) continue;
    Finish++;
    int u = T.second, v;
    for (int Tab = First[u]; Tab; Tab = Next[Tab])
      if (Dist[v = To[Tab]] > Dist[u] + Val[Tab]) {
        Dist[v] = Dist[u] + Val[Tab];
        Heap.push(pair<long long, int>(-Dist[v], v));
      }
  }
  while (!Heap.empty()) Heap.pop();
  for (int i = (1); i <= (k); i++)
    if (Train[i].first >= Dist[Train[i].second])
      Ans++, Visit[i] = 0;
    else {
      Dist[Train[i].second] = Train[i].first;
      Heap.push(pair<long long, int>(-Train[i].first, Train[i].second));
    }
  while (!Heap.empty()) {
    pair<long long, int> T = Heap.top();
    Heap.pop();
    int u = T.second, v;
    if (Dist[u] < -T.first) continue;
    for (int Tab = First[u]; Tab; Tab = Next[Tab])
      if (Dist[v = To[Tab]] > Dist[u] + Val[Tab]) {
        Dist[v] = Dist[u] + Val[Tab];
        Heap.push(pair<long long, int>(-Dist[v], v));
      }
  }
  for (int i = (1); i <= (k); i++)
    if (Train[i].first > Dist[Train[i].second]) {
      if (Visit[i]) Ans++, Visit[i] = 0;
    } else if (Visit[i])
      Change[Train[i].second] = 1, Which[Train[i].second] = i;
  for (int i = (1); i <= (n); i++) Vis[i] = 0;
  for (int i = (1); i <= (k); i++)
    if (Visit[i]) {
      Search(Train[i].second);
    }
  printf("%d\n", Ans);
}
int main() {
  Input();
  Solve();
  return 0;
}
