#include <bits/stdc++.h>
using namespace std;
pair<int, int> max(pair<int, int> a, pair<int, int> b) {
  return a.first > b.first ? a : b;
}
struct seg_tree {
  vector<pair<int, int>> v;
  void init(int n, int l, int r) {
    if (v.size() <= n) v.resize(n + 1);
    v[n] = {0, 0};
    if (l < r) {
      int mid = (l + r) >> 1;
      init(n * 2 + 1, l, mid);
      init(n * 2 + 2, mid + 1, r);
    }
    return;
  }
  void add(int n, int l, int r, int pos, pair<int, int> x) {
    if (l == r)
      v[n] = x;
    else {
      int mid = (l + r) >> 1;
      if (mid < pos)
        add(n * 2 + 2, mid + 1, r, pos, x);
      else
        add(n * 2 + 1, l, mid, pos, x);
      v[n] = max(v[n * 2 + 1], v[n * 2 + 2]);
    }
    return;
  }
  pair<int, int> ask(int n, int l, int r, int L, int R) {
    if (L <= l && r <= R)
      return v[n];
    else if (L > r || l > R)
      return {0, 0};
    else {
      int mid = (l + r) >> 1;
      return max(ask(n * 2 + 1, l, mid, L, R),
                 ask(n * 2 + 2, mid + 1, r, L, R));
    }
  }
};
int main() {
  int px, py, n, m, l, r, a, b, mid, left, right;
  long long int ans = 0, c;
  pair<int, int> temp;
  vector<pair<pair<int, int>, int>> v;
  seg_tree sg;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    v.push_back({{l, r}, i});
  }
  sort(v.begin(), v.end());
  for (int i = 1; i < v.size(); i++)
    if (v[i].first.second <= v[i - 1].first.second)
      v[i] = v[i - 1];
    else if (v[i].first.first == v[i - 1].first.first)
      v[i - 1] = v[i];
  v.resize(unique(v.begin(), v.end()) - v.begin());
  n = (int)v.size() - 1;
  sg.init(0, 0, n);
  for (int i = 0; i <= n; i++)
    sg.add(0, 0, n, i, {v[i].first.second - v[i].first.first, v[i].second});
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%lld", &l, &r, &c);
    temp = {0, 0};
    if (v[0].first.first >= l)
      a = 0;
    else if (v[n].first.first < l) {
      if (v[n].first.second >= l) {
        if (v[n].first.second <= r)
          temp = max(temp, {v[n].first.second - l, v[n].second});
        else
          temp = max(temp, {r - l, v[n].second});
      }
      a = n + 1;
    } else {
      left = 0;
      right = n;
      while (right - left > 1) {
        mid = (left + right) >> 1;
        if (v[mid].first.first >= l)
          right = mid;
        else
          left = mid;
      }
      a = right;
      if (v[left].first.second >= l) {
        if (v[left].first.second <= r)
          temp = max(temp, {v[left].first.second - l, v[left].second});
        else
          temp = max(temp, {r - l, v[left].second});
      }
    }
    if (v[n].first.second <= r)
      b = n;
    else if (v[0].first.second > r) {
      if (v[0].first.first <= r) {
        if (v[0].first.first >= l)
          temp = max(temp, {r - v[0].first.first, v[0].second});
        else
          temp = max(temp, {r - l, v[0].second});
      }
      b = -1;
    } else {
      left = 0;
      right = n;
      while (right - left > 1) {
        mid = (left + right) >> 1;
        if (v[mid].first.second <= r)
          left = mid;
        else
          right = mid;
      }
      b = left;
      if (v[right].first.first <= r) {
        if (v[right].first.first >= l)
          temp = max(temp, {r - v[right].first.first, v[right].second});
        else
          temp = max(temp, {r - l, v[right].second});
      }
    }
    if (a <= b) temp = max(temp, sg.ask(0, 0, n, a, b));
    if (c * temp.first > ans) {
      ans = c * temp.first;
      px = temp.second;
      py = i;
    }
  }
  if (ans == 0)
    printf("0\n");
  else
    printf("%lld\n%d %d\n", ans, px, py);
}
