#include <bits/stdc++.h>
using namespace std;
struct Node {
  int l, r, id;
} p[(1 << 19)];
pair<long long, pair<int, int> > res;
pair<int, int> t[(1 << 19) << 2];
map<int, int> mp;
int n, m, c[(1 << 19)], cnt;
bool cmp1(Node f, Node g) {
  if (f.l != g.l) return f.l < g.l;
  return f.id < g.id;
}
bool cmp2(Node f, Node g) {
  if (f.r != g.r) return f.r > g.r;
  return f.id < g.id;
}
bool cmp3(Node f, Node g) {
  if (f.r != g.r) return f.r < g.r;
  return f.id < g.id;
}
void update(int x, int l, int r, int i, pair<int, int> val) {
  if (l == r)
    t[i] = val;
  else {
    int mid = (l + r) >> 1;
    if (x <= mid)
      update(x, l, mid, i << 1, val);
    else
      update(x, mid + 1, r, (i << 1) + 1, val);
    t[i] = max(t[i << 1], t[(i << 1) + 1]);
  }
}
pair<int, int> query(int tl, int tr, int l, int r, int i) {
  if (tl > r || tr < l) return pair<int, int>(0, 0);
  if (tl <= l && r <= tr) return t[i];
  int mid = (l + r) >> 1;
  return max(query(tl, tr, l, mid, i << 1),
             query(tl, tr, mid + 1, r, (i << 1) + 1));
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].l, &p[i].r), p[i].id = i;
  for (int i = 1; i <= m; i++)
    scanf("%d%d%d", &p[n + i].l, &p[n + i].r, c + i + n), p[i + n].id = i + n;
  sort(p + 1, p + n + m + 1, cmp1);
  for (int i = 1; i <= n + m; i++)
    if (mp.find(p[i].l) == mp.end()) mp[p[i].l] = ++cnt;
  pair<int, int> x = pair<int, int>(0, 0), y = pair<int, int>((1 << 30), 0);
  for (int i = 1; i <= n + m; i++)
    if (p[i].id <= n)
      x = max(x, pair<int, int>(p[i].r, p[i].id));
    else if (x.second)
      res =
          max(res, pair<long long, pair<int, int> >(
                       (long long)(min(x.first, p[i].r) - p[i].l) * c[p[i].id],
                       pair<int, int>(x.second, p[i].id - n)));
  sort(p + 1, p + n + m + 1, cmp2);
  for (int i = 1; i <= n + m; i++)
    if (p[i].id <= n)
      y = min(y, pair<int, int>(p[i].l, p[i].id));
    else if (y.second)
      res =
          max(res, pair<long long, pair<int, int> >(
                       (long long)(p[i].r - max(y.first, p[i].l)) * c[p[i].id],
                       pair<int, int>(y.second, p[i].id - n)));
  sort(p + 1, p + n + m + 1, cmp3);
  for (int i = 1; i <= n + m; i++)
    if (p[i].id <= n)
      update(mp[p[i].l], 1, cnt, 1, pair<int, int>(p[i].r - p[i].l, p[i].id));
    else {
      pair<int, int> val = query(mp[p[i].l], cnt, 1, cnt, 1);
      res = max(res, pair<long long, pair<int, int> >(
                         (long long)val.first * c[p[i].id],
                         pair<int, int>(val.second, p[i].id - n)));
    }
  cout << res.first << endl;
  if (res.first) cout << res.second.first << " " << res.second.second << endl;
  return 0;
}
