Problem: Vasya plays one very well-known and extremely popular MMORPG game. His game character has k skill; currently the i-th of them equals to ai. Also this game has a common rating table in which the participants are ranked according to the product of all the skills of a hero in the descending order.

Vasya decided to 'upgrade' his character via the game store. This store offers n possible ways to improve the hero's skills; Each of these ways belongs to one of three types:

  1. assign the i-th skill to b; 
  2. add b to the i-th skill; 
  3. multiply the i-th skill by b. 



Unfortunately, a) every improvement can only be used once; b) the money on Vasya's card is enough only to purchase not more than m of the n improvements. Help Vasya to reach the highest ranking in the game. To do this tell Vasya which of improvements he has to purchase and in what order he should use them to make his rating become as high as possible. If there are several ways to achieve it, print any of them.

Input

The first line contains three numbers — k, n, m (1 ≤ k ≤ 105, 0 ≤ m ≤ n ≤ 105) — the number of skills, the number of improvements on sale and the number of them Vasya can afford.

The second line contains k space-separated numbers ai (1 ≤ ai ≤ 106), the initial values of skills.

Next n lines contain 3 space-separated numbers tj, ij, bj (1 ≤ tj ≤ 3, 1 ≤ ij ≤ k, 1 ≤ bj ≤ 106) — the type of the j-th improvement (1 for assigning, 2 for adding, 3 for multiplying), the skill to which it can be applied and the value of b for this improvement.

Output

The first line should contain a number l (0 ≤ l ≤ m) — the number of improvements you should use.

The second line should contain l distinct space-separated numbers vi (1 ≤ vi ≤ n) — the indices of improvements in the order in which they should be applied. The improvements are numbered starting from 1, in the order in which they appear in the input. 

Examples

Input

2 4 3
13 20
1 1 14
1 2 30
2 1 6
3 2 2


Output

3
2 3 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
  i >> p.first >> p.second;
  return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
  for (auto& v : t) {
    i >> v;
  }
  return i;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& o, const pair<T, U>& p) {
  o << p.first << ' ' << p.second;
  return o;
}
template <typename T>
std::ostream& operator<<(std::ostream& o, const vector<T>& t) {
  if (t.empty()) o << '\n';
  for (size_t i = 0; i < t.size(); ++i) {
    o << t[i] << " \n"[i == t.size() - 1];
  }
  return o;
}
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
bool in(T a, T b, T c) {
  return a <= b && b < c;
}
unsigned int logceil(int first) {
  return 8 * sizeof(int) - __builtin_clz(first);
}
namespace std {
template <typename T, typename U>
struct hash<pair<T, U>> {
  hash<T> t;
  hash<U> u;
  size_t operator()(const pair<T, U>& p) const {
    return t(p.first) ^ (u(p.second) << 7);
  }
};
}  // namespace std
template <typename T, typename F>
T bsh(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      l = m + 1;
      r = m;
    } else {
      h = m - 1;
    }
  }
  return r;
}
template <typename F>
double bshd(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      l = m;
    } else {
      h = m;
    }
  }
  return (l + h) / 2;
}
template <typename T, typename F>
T bsl(T l, T h, const F& f) {
  T r = -1, m;
  while (l <= h) {
    m = (l + h) / 2;
    if (f(m)) {
      h = m - 1;
      r = m;
    } else {
      l = m + 1;
    }
  }
  return r;
}
template <typename F>
double bsld(double l, double h, const F& f, double p = 1e-9) {
  unsigned int r = 3 + (unsigned int)log2((h - l) / p);
  while (r--) {
    double m = (l + h) / 2;
    if (f(m)) {
      h = m;
    } else {
      l = m;
    }
  }
  return (l + h) / 2;
}
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
template <typename T>
class vector2 : public vector<vector<T>> {
 public:
  vector2() {}
  vector2(size_t a, size_t b, T t = T())
      : vector<vector<T>>(a, vector<T>(b, t)) {}
};
template <typename T>
class vector3 : public vector<vector2<T>> {
 public:
  vector3() {}
  vector3(size_t a, size_t b, size_t c, T t = T())
      : vector<vector2<T>>(a, vector2<T>(b, c, t)) {}
};
template <typename T>
class vector4 : public vector<vector3<T>> {
 public:
  vector4() {}
  vector4(size_t a, size_t b, size_t c, size_t d, T t = T())
      : vector<vector3<T>>(a, vector3<T>(b, c, d, t)) {}
};
template <typename T>
class vector5 : public vector<vector4<T>> {
 public:
  vector5() {}
  vector5(size_t a, size_t b, size_t c, size_t d, size_t e, T t = T())
      : vector<vector4<T>>(a, vector4<T>(b, c, d, e, t)) {}
};
pair<unsigned long long, unsigned long long> mulull(unsigned long long a,
                                                    unsigned long long b) {
  __int128 result = (__int128)a * (__int128)b;
  return {(unsigned long long)(result >> 64), (unsigned long long)result};
}
bool fractionGreaterOrEqual(long long a, long long b, long long c,
                            long long d) {
  if (b < 0) {
    b = -b;
    a = -a;
  }
  if (d < 0) {
    d = -d;
    c = -c;
  }
  return a < 0 && c < 0 ? mulull(-a, d) <= mulull(-c, b)
                        : (a >= 0) && (c < 0 || mulull(a, d) >= mulull(c, b));
}
bool fractionEqual(long long a, long long b, long long c, long long d) {
  return a == c && b == d;
}
bool fractionSmaller(long long a, long long b, long long c, long long d) {
  return fractionGreaterOrEqual(c, d, a, b) && !fractionEqual(a, b, c, d);
}
class Fraction {
  friend ostream& operator<<(ostream& os, const Fraction& f);

 public:
  Fraction(long long u = 0, long long v = 1) : u(u), v(v) { norm(); }
  bool operator==(const Fraction& o) const { return u == o.u && v == o.v; }
  bool operator!=(const Fraction& o) const { return u != o.u || v != o.v; }
  bool operator<(const Fraction& o) const {
    return fractionSmaller(u, v, o.u, o.v);
  }
  Fraction operator-(const Fraction& o) { return Fraction(-u, v); }
  Fraction& operator+=(const Fraction& o) {
    u = u * o.v + v * o.u;
    v *= o.v;
    return norm();
  }
  Fraction& operator-=(const Fraction& o) {
    u = u * o.v - v * o.u;
    v *= o.v;
    return norm();
  }
  Fraction& operator/=(const Fraction& o) {
    u = u * o.v;
    v = o.u * v;
    return norm();
  }
  Fraction& operator*=(const Fraction& o) {
    u *= o.u;
    v *= o.v;
    return norm();
  }
  Fraction operator+(const Fraction& o) const {
    Fraction f(*this);
    return f += o;
  }
  Fraction operator-(const Fraction& o) const {
    Fraction f(*this);
    return f -= o;
  }
  Fraction operator*(const Fraction& o) const {
    Fraction f(*this);
    return f *= o;
  }
  Fraction operator/(const Fraction& o) const {
    Fraction f(*this);
    return f /= o;
  }

 private:
  Fraction& norm() {
    long long g = gcd(abs(u), abs(v));
    u /= g;
    v /= g;
    return *this;
  }
  long long u, v;
};
ostream& operator<<(ostream& os, const Fraction& f) {
  os << f.u << '/' << f.v;
  return os;
}
struct Type {
  vector<std::pair<int, int>> add;
  std::pair<int, int> ass;
};
class TaskD {
 public:
  void solve(istream& cin, ostream& cout) {
    int K, N, M;
    cin >> K >> N >> M;
    vector<long long> A(K);
    cin >> A;
    vector<Type> T(K, {{}, {-1, -1}});
    vector<int> Q(N);
    vector<std::pair<int, int>> MLT;
    for (int i = 0; i < N; ++i) {
      int t, j, b;
      cin >> t >> j >> b;
      --j;
      Q[i] = t;
      if (t == 1) T[j].ass = max(T[j].ass, {b, i});
      if (t == 2) T[j].add.push_back({b, i});
      if (t == 3) MLT.push_back({b, i});
    }
    vector<pair<Fraction, int>> H;
    for (std::pair<int, int> mult : MLT)
      H.push_back({{mult.first}, mult.second});
    for (int i = 0; i < K; ++i) {
      if (T[i].ass.first > A[i]) {
        T[i].add.push_back({T[i].ass.first - A[i], T[i].ass.second});
      }
      sort(T[i].add.begin(), T[i].add.end());
      reverse(T[i].add.begin(), T[i].add.end());
      for (std::pair<int, int> a : T[i].add) {
        H.push_back({{A[i] + a.first, A[i]}, a.second});
        A[i] += a.first;
      }
    }
    sort(H.begin(), H.end());
    reverse(H.begin(), H.end());
    vector<bool> U(N, false);
    for (int i = 0; i < min(M, (int)H.size()); ++i) {
      U[H[i].second] = true;
    }
    vector<int> Ans;
    for (int i = 1; i <= 3; ++i) {
      for (int t = 0; t < N; ++t) {
        if (U[t] && Q[t] == i) Ans.push_back(t + 1);
      }
    }
    cout << Ans.size() << '\n';
    cout << Ans;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  TaskD solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}