#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
ostream &operator<<(ostream &out, pair<T, T1> obj) {
  out << "(" << obj.first << "," << obj.second << ")";
  return out;
}
template <typename T, typename T1>
ostream &operator<<(ostream &out, map<T, T1> cont) {
  typename map<T, T1>::const_iterator itr = cont.begin();
  typename map<T, T1>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> cont) {
  typename set<T>::const_iterator itr = cont.begin();
  typename set<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> cont) {
  typename multiset<T>::const_iterator itr = cont.begin();
  typename multiset<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T,
          template <typename ELEM, typename ALLOC = allocator<ELEM>> class CONT>
ostream &operator<<(ostream &out, CONT<T> cont) {
  typename CONT<T>::const_iterator itr = cont.begin();
  typename CONT<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T, unsigned int N, typename CTy, typename CTr>
typename enable_if<!is_same<T, char>::value, basic_ostream<CTy, CTr> &>::type
operator<<(basic_ostream<CTy, CTr> &out, const T (&arr)[N]) {
  for (auto i = 0; i < N; ++i) out << arr[i] << " ";
  out << endl;
  return out;
}
template <typename T>
T gcd(T a, T b) {
  T min_v = min(a, b);
  T max_v = max(a, b);
  while (min_v) {
    T temp = max_v % min_v;
    max_v = min_v;
    min_v = temp;
  }
  return max_v;
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
T fast_exp_pow(T base, T exp, T mod) {
  long long res = 1;
  while (exp) {
    if (exp & 1) {
      res *= base;
      res %= mod;
    }
    exp >>= 1;
    base *= base;
    base %= mod;
  }
  return res % mod;
}
int N, M, K, U, V, S, answer;
int used[100010], total[100010];
long long X, Y;
long long min_dist[100010];
vector<pair<pair<int, long long>, int>> graph[100010];
vector<pair<int, long long>> trains;
priority_queue<pair<pair<int, long long>, int>,
               vector<pair<pair<int, long long>, int>>,
               greater<pair<pair<int, long long>, int>>>
    que;
void dijkstra() {
  que.push(make_pair(make_pair(0, 0), 1));
  while (!que.empty()) {
    int node = que.top().second;
    int type = que.top().first.second;
    long long cost = que.top().first.first;
    que.pop();
    if (min_dist[node] != -1) continue;
    min_dist[node] = cost;
    used[node] = type;
    for (auto elem : graph[node]) {
      int conn_node = elem.first.first;
      int weight = elem.first.second;
      int road_type = elem.second;
      long long new_cost = cost + weight;
      if (min_dist[conn_node] == -1 || min_dist[conn_node] > new_cost) {
        que.push(make_pair(make_pair(new_cost, road_type), conn_node));
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (auto i = 0; i < M; ++i) {
    scanf("%d%d%lld", &U, &V, &X);
    graph[U].emplace_back(make_pair(V, X), 0);
    graph[V].emplace_back(make_pair(U, X), 0);
  }
  for (auto i = 0; i < K; ++i) {
    scanf("%d%lld", &S, &Y);
    graph[1].emplace_back(make_pair(S, Y), 1);
    graph[S].emplace_back(make_pair(1, Y), 1);
    trains.emplace_back(S, Y);
  }
  memset(min_dist, -1, sizeof(min_dist));
  dijkstra();
  for (auto elem : trains) {
    int city = elem.first;
    int cost = elem.second;
    if (cost > min_dist[city])
      ++answer;
    else {
      if (!used[city])
        ++answer;
      else
        ++total[city];
    }
  }
  for (auto i = 1; i <= N; ++i) {
    if (total[i]) answer += total[i] - 1;
  }
  printf("%d\n", answer);
  return 0;
}
