/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com)
 */

#include <bits/stdc++.h>
#include "optimization.h"

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()

int main() {
  int n = readInt(), tmp;
  vector<int> h(n), l(n), p(n), r(n);
  auto lh_less = [&l, &h](int i, int j) {
    #define F(i) (l[i] + h[i])
    return F(i) < F(j);
  };
  long long sh = 0;
  forn(i, n) {
    h[i] = readInt();
    l[i] = readInt();
    p[i] = i;
    sh += h[i];
  }
  int H = readInt();
  sort(all(p), lh_less);
  
  set<pair<int, int>> s;
  for (int i : p)
    if (sh + l[i] >= H)
      sh -= h[i], s.insert({h[i], i});
    else if (s.size() && (tmp = s.rbegin()->first - h[i]) > 0)
      sh += tmp, s.erase(--s.end()), s.insert({h[i], i});
  r.erase(transform(s.begin(), s.end(), r.begin(), [](pair<int,int> x){ return x.second; }), r.end());
  sort(all(r), lh_less);
  writeInt(r.size(), '\n');
  for (int x : r)
    writeInt(x + 1, ' ');
}
