Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.

The camera's memory is d megabytes. Valera's camera can take photos of high and low quality. One low quality photo takes a megabytes of memory, one high quality photo take b megabytes of memory. For unknown reasons, each client asks him to make several low quality photos and several high quality photos. More formally, the i-th client asks to make xi low quality photos and yi high quality photos.

Valera wants to serve as many clients per day as possible, provided that they will be pleased with his work. To please the i-th client, Valera needs to give him everything he wants, that is, to make xi low quality photos and yi high quality photos. To make one low quality photo, the camera must have at least a megabytes of free memory space. Similarly, to make one high quality photo, the camera must have at least b megabytes of free memory space. Initially the camera's memory is empty. Valera also does not delete photos from the camera so that the camera's memory gradually fills up.

Calculate the maximum number of clients Valera can successfully serve and print the numbers of these clients.

Input

The first line contains two integers n and d (1 ≤ n ≤ 105, 1 ≤ d ≤ 109) — the number of clients and the camera memory size, correspondingly. The second line contains two integers a and b (1 ≤ a ≤ b ≤ 104) — the size of one low quality photo and of one high quality photo, correspondingly. 

Next n lines describe the clients. The i-th line contains two integers xi and yi (0 ≤ xi, yi ≤ 105) — the number of low quality photos and high quality photos the i-th client wants, correspondingly. 

All numbers on all lines are separated by single spaces. 

Output

On the first line print the answer to the problem — the maximum number of clients that Valera can successfully serve. Print on the second line the numbers of the client in any order. All numbers must be distinct. If there are multiple answers, print any of them. The clients are numbered starting with 1 in the order in which they are defined in the input data.

Examples

Input

3 10
2 3
1 4
2 1
1 0


Output

2
3 2 

Input

3 6
6 6
1 1
1 0
1 0


Output

1
2

Difficulty: MEDIUM
Tags: Sorting

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
(n, d) = map(int, input().split())
(d1, d2) = map(int, input().split())
arr = [0] * n
for i in range(n):
	(a, b) = map(int, input().split())
	arr[i] = [d1 * a + d2 * b, i + 1]
arr.sort()
(res, idx) = (0, '')
for i in arr:
	if d - i[0] < 0:
		break
	d -= i[0]
	res += 1
	idx += str(i[1]) + ' '
print(res)
print(idx)


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
clients = []
for i in range(n):
	(x_i, y_i) = map(int, input().split())
	clients.append({'number': i + 1, 'size': x_i * a + y_i * b})
clients = sorted(clients, key=lambda x: x['size'])
sum = 0
cnt = len(clients)
for i in range(len(clients)):
	sum += clients[i]['size']
	if sum > d:
		cnt = i
		break
print(cnt)
for i in range(cnt):
	print(clients[i]['number'], end=' ')


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
ans = []
for i in range(n):
	(x, y) = map(int, input().split())
	ans.append([x * a + y * b, i + 1])
ans.sort()
nans = []
for i in range(len(ans)):
	if d >= ans[i][0]:
		nans.append(ans[i][1])
		d = d - ans[i][0]
	else:
		break
print(len(nans))
print(*nans)


(n, d) = list(map(int, input().split()))
(a, b) = list(map(int, input().split()))
res = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	res.append((x, y, i + 1))
res.sort(key=lambda x: a * x[0] + b * x[1])
output = []
for (x, y, idx) in res:
	if a * x + b * y <= d:
		d -= a * x + b * y
		output.append(idx)
	else:
		break
print(len(output))
for i in output:
	print(i, end=' ')
print()


(n, d) = [int(x) for x in input().split()]
(a, b) = [int(x) for x in input().split()]
arr = []
for _ in range(n):
	arr.append([int(x) for x in input().split()] + [_ + 1])
arr.sort(key=lambda x: a * x[0] + b * x[1])
ans = []
for i in arr:
	d -= a * i[0] + b * i[1]
	if d >= 0:
		ans.append(i[2])
	else:
		d += a * i[0] + b * i[1]
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
req = []
for i in range(n):
	(x, y) = map(int, input().split())
	req.append([x, y, i])
ans = []
req.sort(key=lambda x: [x[0] * a + x[1] * b])
for i in range(n):
	curr = req[i][0] * a + req[i][1] * b
	if d >= curr:
		ans.append(req[i][2] + 1)
		d -= curr
	else:
		break
print(len(ans))
print(*ans)


import re
import itertools
from collections import Counter, deque

class Task:
	(memory, a, b) = [0] * 3
	clients = []
	answer = []

	def getData(self):
		(n, self.memory) = [int(x) for x in input().split(' ')]
		(self.a, self.b) = [int(x) for x in input().split(' ')]
		for i in range(1, n + 1):
			self.clients += [[i] + [int(x) for x in input().split(' ')]]

	def solve(self):
		self.clients.sort(key=self.clientRequiredMemory)
		for current in self.clients:
			requiredMemory = current[1] * self.a + current[2] * self.b
			if requiredMemory <= self.memory:
				self.memory -= requiredMemory
				self.answer += [current[0]]
			else:
				break

	def clientRequiredMemory(self, client):
		return client[1] * self.a + client[2] * self.b

	def printAnswer(self):
		print(len(self.answer))
		print(re.sub('[\\[\\],]', '', str(self.answer)))
task = Task()
task.getData()
task.solve()
task.printAnswer()


import sys
input = sys.stdin.buffer.readline
import os
from math import *
(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
price = []
for i in range(n):
	(x, y) = map(int, input().split())
	price.append([x * a + y * b, i + 1])
price.sort()
ans = []
s = 0
i = 0
while i < n:
	s += price[i][0]
	if s <= d:
		ans.append(price[i][1])
	else:
		break
	i += 1
print(len(ans))
for x in ans:
	print(x, end=' ')


from sys import stdin

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return [str(x) for x in stdin.readline().split()]

def arr_inp_enu(n):
	return [[i, arr_inp(1)] for i in range(1, n + 1)]

def add(d):
	for i in range(n):
		arr[i][1][0] *= a
		arr[i][1][1] *= b
	arr.sort(key=lambda x: x[1][0] + x[1][1])
	ans = []
	for i in range(n):
		s = sum(arr[i][1])
		if s <= d:
			d -= s
			ans.append(arr[i][0])
		else:
			break
	print(len(ans))
	print(*ans)
(n, d) = arr_inp(1)
(a, b) = arr_inp(1)
arr = arr_inp_enu(n)
add(d)


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
s = [None] * n
for i in range(n):
	(x, y) = map(int, input().split())
	s[i] = [a * x + b * y, i + 1]
s.sort()
res = []
for i in range(n):
	if d - s[i][0] >= 0:
		res.append(s[i][1])
		d -= s[i][0]
	else:
		break
print(str(len(res)) + '\n' + ' '.join(map(str, res)))


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	(n, d) = num_input()
	(a, b) = num_input()
	arr = {}
	for _ in range(n):
		(x, y) = num_input()
		arr[_] = a * x + b * y
	arr = sort_dict(arr)
	ans = []
	temp = 0
	for (u, v) in arr:
		temp += v
		if temp <= d:
			ans.append(str(u + 1))
		else:
			break
	print(len(ans))
	print(' '.join(ans))
t = 1
for _ in range(t):
	solve()


from operator import itemgetter
line1 = input()
line1 = line1.split(' ')
n = int(line1[0])
d = int(line1[1])
line2 = input()
line2 = line2.split(' ')
a = int(line2[0])
b = int(line2[1])
clients = []
for i in range(1, n + 1):
	linei = input()
	linei = linei.split(' ')
	clients.append([a * int(linei[0]) + b * int(linei[1]), i])
clients.sort(key=itemgetter(0))
c_count = 0
output2 = []
while 1:
	if c_count > len(clients) - 1:
		break
	d -= clients[c_count][0]
	if d < 0:
		break
	c_count += 1
	output2.append(clients[c_count - 1][1])
print(c_count)
for i in range(0, len(output2)):
	print(output2[i], end=' ')


master = []
(n, total) = map(int, input().split())
(a, b) = map(int, input().split())
for t in range(1, n + 1):
	(one, two) = map(int, input().split())
	one = one * a
	two = two * b
	summ = one + two
	master.append((t, summ))
final = []
master.sort(key=lambda x: x[1])
empty = 0
for t in master:
	empty += t[1]
	if empty > total:
		break
	else:
		final.append(t[0])
print(len(final))
k = ' '.join(map(str, final))
print(k)


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
a2 = []
for i in range(n):
	(q, w) = map(int, input().split())
	a2.append((a * q + w * b, i))
a2.sort()
ans = []
sumz = 0
for i in range(n):
	if sumz + a2[i][0] > d:
		break
	ans.append(a2[i][1])
	sumz += a2[i][0]
print(len(ans))
for i in ans:
	print(i + 1, end=' ')


(n, d) = [int(i) for i in input().split()]
(a, b) = [int(i) for i in input().split()]
(arr, res) = ([], [])
for j in range(n):
	(x, y) = [int(i) for i in input().split()]
	arr.append([x * a + y * b, j])
arr.sort()
sum = 0
for i in range(n):
	sum = sum + arr[i][0]
	if sum > d:
		break
	res.append(arr[i][1] + 1)
print(len(res))
for i in res:
	print(i, end=' ')
print('')


lst = list(map(int, input().split()))
n = lst[0]
d = lst[1]
lst = list(map(int, input().split()))
a = lst[0]
b = lst[1]
ans = []
for x in range(0, n):
	lst = list(map(int, input().split()))
	ans.append([lst[0] * a + lst[1] * b, x + 1])
ans.sort()
sum = 0
i = 0
for s in range(0, n):
	i += 1
	sum += ans[s][0]
	if sum > d:
		i -= 1
		sum -= ans[s][0]
		break
print(i)
for f in range(0, i):
	print(ans[f][1], ' ', end='')


I = lambda : map(int, input().split())
R = range
(n, d) = I()
(a, b) = I()
m = []
v = []
for i in R(n):
	(x, y) = I()
	v += [x * a + y * b]
	m += [i]
m = sorted(m, key=lambda x: v[x])
for i in R(n):
	if v[m[i]] > d:
		n = i
		break
	d -= v[m[i]]
print(n)
for i in R(n):
	print(m[i] + 1, end=' ')


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
mod = 10 ** 9 + 7
for _ in range(1):
	(n, memory) = map(int, input().split())
	(low, high) = map(int, input().split())
	client_costs = []
	for i in range(n):
		(l, h) = map(int, input().split())
		cost = l * low + high * h
		client_costs.append((cost, i + 1))
	client_costs.sort()
	clients = []
	count = 0
	costs = 0
	for i in range(n):
		costs += client_costs[i][0]
		if costs > memory:
			break
		clients.append(client_costs[i][1])
		count += 1
	if count == 0:
		print(count)
	else:
		print(count)
		print(*clients)


from functools import reduce
from operator import *
from math import *
from sys import *
from string import *
from collections import *
setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
(n, d) = RI()
(a, b) = RI()
vals = [0] * n
ans = []
for i in range(n):
	(x, y) = RI()
	vals[i] = (x * a + y * b, i + 1)
vals.sort()
i = 0
while i < n and d >= vals[i][0]:
	ans.append(vals[i][1])
	d -= vals[i][0]
	i += 1
print(i)
print(*ans)


import sys
import math
(n, z) = [int(x) for x in sys.stdin.readline().split()]
(a, b) = [int(x) for x in sys.stdin.readline().split()]
v = []
for i in range(n):
	(x, y) = [int(x) for x in sys.stdin.readline().split()]
	v.append((x * a + y * b, i + 1))
v.sort(key=lambda x: x[0])
res = 0
k = []
for i in range(n):
	if z - v[i][0] >= 0:
		res += 1
		k.append(str(v[i][1]))
		z -= v[i][0]
	else:
		break
print(res)
print(' '.join(k))


(n, d) = map(int, input().split())
(d1, d2) = map(int, input().split())
datos = []
for i in range(n):
	(a, b) = map(int, input().split())
	datos.append((a * d1 + b * d2, i + 1))
datos = sorted(datos)
posiciones = ''
cont = 0
acum = 0
res = []
for x in datos:
	if x[0] <= d:
		res.append(x[1])
		d -= x[0]
	else:
		break
print(len(res))
print(' '.join(map(str, res)))


from sys import *
inp = lambda : stdin.readline()

def main():
	(n, d) = map(int, inp().split())
	(a, b) = map(int, inp().split())
	(l, ans) = ([], [])
	for i in range(n):
		(x, y) = map(int, inp().split())
		l.append((x * a + y * b, i + 1))
	l = sorted(l)
	for i in l:
		if i[0] <= d:
			ans.append(i[1])
			d -= i[0]
	print(len(ans))
	print(' '.join(map(str, ans)))
main()


import traceback
import math
from collections import defaultdict
from functools import lru_cache
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def geti():
	return int(input())

def gets():
	return input()

def getil():
	return list(map(int, input().split()))

def getsl():
	return input().split()

def get2d(nrows, ncols, n=0):
	return [[n] * ncols for r in range(nrows)]
inf = float('inf')
mod = 10 ** 9 + 7

def main():
	(N, d) = getil()
	(a, b) = getil()
	c = []
	for _ in range(N):
		(x, y) = getil()
		c.append(x * a + y * b)
	s = sorted(range(len(c)), key=lambda x: c[x])
	ans = []
	for k in s:
		v = c[k]
		if d - v < 0:
			break
		d -= v
		ans.append(k + 1)
	return ans
try:
	ans = main()
	print(len(ans))
	print(*ans)
except Exception as e:
	traceback.print_exc()


def readln():
	return tuple(map(int, input().split()))
(n, d) = readln()
(a, b) = readln()
lst = []
for _ in range(n):
	(x, y) = readln()
	lst.append((a * x + b * y, _ + 1))
lst.sort()
ans = []
s = 0
for (v, i) in lst:
	if s + v > d:
		break
	s += v
	ans.append(i)
print(len(ans))
print(*ans)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	(n, d) = read()
	(a, b) = read()
	clients = []
	for i in range(n):
		(x, y) = read()
		summ = x * a + y * b
		clients.append([summ, x, y, i + 1])
	clients.sort()
	totalphotos = 0
	ans = []
	for photos in clients:
		ind = photos[3]
		if totalphotos + photos[0] > d:
			break
		ans.append(ind)
		totalphotos += photos[0]
	print(len(ans))
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	solve()


R = lambda : map(int, input().split())
(n, d) = R()
(a, b) = R()

def get():
	(x, y) = R()
	return a * x + b * y
s = sorted([(get(), i) for i in range(1, n + 1)])
ans = []
for i in range(n):
	if d >= s[i][0]:
		ans += [s[i][1]]
		d -= s[i][0]
	else:
		break
print(len(ans))
print(*ans)


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
l = []
for i in range(1, n + 1):
	(a1, b1) = map(int, input().split())
	l.append([a1 * a + b1 * b, i])
l.sort()
temp = d
ans = []
for i in l:
	if i[0] <= temp:
		ans.append(i[1])
		temp -= i[0]
	else:
		break
print(len(ans))
print(*ans)


(n, d) = map(int, input().split())
lis = []
aa = []
(m1, m2) = map(int, input().split())
for i in range(n):
	(a, b) = map(int, input().split())
	lis.append([m1 * a + m2 * b, i + 1])
lis.sort()
ans = 0
for i in range(n):
	if lis[i][0] + ans <= d:
		ans += lis[i][0]
		aa.append(lis[i][1])
print(len(aa))
print(*aa)


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math
import heapq
import re

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	(n, xx) = ain()
	(a, b) = ain()
	d = deque([])
	for i in range(n):
		(x, y) = ain()
		d.append([x * a + y * b, i + 1])
	l = sorted(d)
	c = 0
	ans = deque([])
	for i in range(n):
		if l[i][0] <= xx:
			c += 1
			xx -= l[i][0]
			ans.append(l[i][1])
	print(c)
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	(n, d) = map(int, input().split())
	(a, b) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())) + [i + 1])
	l.sort(key=lambda x: a * x[0] + b * x[1])
	ans = 0
	res = []
	for item in l:
		temp = a * item[0] + b * item[1]
		if temp > d:
			break
		else:
			d -= temp
			ans += 1
			res.append(item[2])
	if ans:
		print(ans)
		print(*res)
	else:
		print(ans)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
x = []
for i in range(n):
	(q, w) = map(int, input().split())
	x.append([q, w, i + 1])
x.sort(key=lambda i: a * i[0] + b * i[1])
z = []
s = 0
for i in range(n):
	if s + a * x[i][0] + b * x[i][1] <= d:
		s = s + a * x[i][0] + b * x[i][1]
		z.append(x[i][2])
print(len(z))
for i in z:
	print(i, end=' ')


inp = [int(x) for x in input().split()]
n = inp[0]
d = inp[1]
size = [int(x) for x in input().split()]
lowSize = size[0]
highSize = size[1]
sizeByCustomer = []
for i in range(n):
	photosCount = [int(x) for x in input().split()]
	photosLowCount = photosCount[0]
	photosHighCount = photosCount[1]
	totalSize = photosLowCount * lowSize + photosHighCount * highSize
	sizeByCustomer.append([totalSize, i + 1])
sizeByCustomer.sort(key=lambda x: x[0])
canContinue = True
i = 0
result = []
while canContinue and i < n:
	if d - sizeByCustomer[i][0] >= 0:
		result.append(str(sizeByCustomer[i][1]))
		d -= sizeByCustomer[i][0]
		i += 1
	else:
		canContinue = False
print(len(result))
print(' '.join(result))


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
t = [0] * n
for i in range(n):
	(x, y) = map(int, input().split())
	t[i] = (a * x + b * y, i)
t.sort()
(j, s) = (n, 0)
for i in range(n):
	s += t[i][0]
	if s > d:
		j = i
		break
print(j)
print(' '.join((str(t[i][1] + 1) for i in range(j))))


(n, d) = tuple([int(z) for z in input().split(' ')])
(a, b) = tuple([int(z) for z in input().split(' ')])
c_arr = list()
for i in range(1, n + 1):
	(f, g) = tuple((int(z) for z in input().split(' ')))
	t_arr = [f * a + g * b, i]
	c_arr.append(t_arr)
c_arr.sort(key=lambda item: item[0])
r_arr = []
c = 0
i = 0
while i < len(c_arr) and c + c_arr[i][0] <= d:
	c = c + c_arr[i][0]
	r_arr.append(c_arr[i][1])
	i = i + 1
print(len(r_arr))
print(' '.join([str(z) for z in r_arr]))


(n, d) = map(int, input().split())
(a, b) = map(int, input().split())
people = []
for i in range(1, n + 1):
	(x, y) = map(int, input().split())
	people.append((a * x + b * y, i))
people.sort()
pos = 0
while True:
	d -= people[pos][0]
	if d < 0:
		break
	pos += 1
	if pos == n:
		break
print(pos)
if pos != 0:
	print(' '.join(map(lambda person: str(person[1]), people[:pos])))


R = lambda : map(int, input().rstrip().split())
(n, d) = R()
(a, b) = R()
l = []
for i in range(n):
	(x, y) = R()
	cost = x * a + y * b
	l.append([i + 1, cost])
l.sort(key=lambda x: x[1])
t = 0
cost = 0
i = 0
while i < n:
	if cost + l[i][1] <= d:
		cost += l[i][1]
		i += 1
		t += 1
	else:
		break
print(t)
for i in range(t):
	print(l[i][0], end=' ')


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
(n, d) = (int(i) for i in input().split())
(a, b) = (int(i) for i in input().split())
l = []
for i in range(n):
	(x, y) = (int(i) for i in input().split())
	l.append(x * a + y * b)
d1 = {}
for i in range(n):
	if l[i] in d1:
		d1[l[i]].append(i + 1)
	else:
		d1[l[i]] = [i + 1]
c = 0
s1 = 0
ans = []
s = set(l)
l1 = sorted(list(s))
for i in l1:
	if s1 + i > d:
		break
	else:
		for j in d1[i]:
			if s1 + i <= d:
				s1 += i
				c += 1
				ans.append(j)
			else:
				break
print(c)
print(*ans)


R = lambda : list(map(int, input().split()))
(n, d) = R()
(a, b) = R()
lst1 = []
lst2 = []
lst3 = []
sum = 0
cnt = 1
for i in range(0, n):
	(x, y) = R()
	p = x * a + y * b
	lst1.append(p)
	lst2.append(i)
iteams = list(zip(lst1, lst2))
iteams.sort()
for i in range(0, n):
	sum = sum + iteams[i][0]
	if sum <= d:
		lst3.append(iteams[i][1] + 1)
		cnt = cnt + 1
print(len(lst3))
print(*lst3)