import java.io.*;
import java.util.*;

public class FancyFence{
    public static int anglePerSide(int sides){
        return (180 * (sides - 2)) / sides;
    }

    public static String algorithm(int a){
        int sides = 3;
        while(true){
            int next = anglePerSide(sides);
            if (next == a){
                return "YES";
            }else if(next > a){
                return "NO";
            }
            sides++;
        }
    }
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        while (n>0){
            out.println(algorithm(sc.nextInt()));
            n--;
        }

        out.close();
    }

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
       BufferedReader br;
       StringTokenizer st;

       public MyScanner() {
          br = new BufferedReader(new InputStreamReader(System.in));
       }

       String next() {
           while (st == null || !st.hasMoreElements()) {
               try {
                   st = new StringTokenizer(br.readLine());
               } catch (IOException e) {
                   e.printStackTrace();
               }
           }
           return st.nextToken();
       }

       int nextInt() {
           return Integer.parseInt(next());
       }

       long nextLong() {
           return Long.parseLong(next());
       }

       double nextDouble() {
           return Double.parseDouble(next());
       }

       String nextLine(){
           String str = "";
       try {
          str = br.readLine();
       } catch (IOException e) {
          e.printStackTrace();
       }
       return str;
       }

    }
    //--------------------------------------------------------
 }


import java.io.*;
import java.util.*;

public class FancyFence{
    public static double anglePerSide(int sides){
        return (180 * (sides - 2)) / (double)sides;
    }

    public static String algorithm(int a){
        int sides = 3;
        while(true){
            //double next = anglePerSide(sides);
            out.println(next);
            if (next == a){
                return "YES";
            }else if(next > a){
                return "NO";
            }
            sides++;
        }
    }
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        while (n>0){
            out.println(algorithm(sc.nextInt()));
            n--;
        }

        out.close();
    }

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
       BufferedReader br;
       StringTokenizer st;

       public MyScanner() {
          br = new BufferedReader(new InputStreamReader(System.in));
       }

       String next() {
           while (st == null || !st.hasMoreElements()) {
               try {
                   st = new StringTokenizer(br.readLine());
               } catch (IOException e) {
                   e.printStackTrace();
               }
           }
           return st.nextToken();
       }

       int nextInt() {
           return Integer.parseInt(next());
       }

       long nextLong() {
           return Long.parseLong(next());
       }

       double nextDouble() {
           return Double.parseDouble(next());
       }

       String nextLine(){
           String str = "";
       try {
          str = br.readLine();
       } catch (IOException e) {
          e.printStackTrace();
       }
       return str;
       }

    }
    //--------------------------------------------------------
 }


import java.io.*;
import java.util.*;

public class FancyFence{
    public static double anglePerSide(int sides){
        return (180 * (sides - 2)) / (double)sides;
    }

    public static String algorithm(int a){
        int sides = 3;
        while(true){
            double next = anglePerSide(sides);
            //out.println(next);
            if (next == a){
                return "YES";
            }else if(next > a){
                return "NO";
            }
            sides++;
        }
    }
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        while (n>0){
            out.println(algorithm(sc.nextInt()));
            n--;
        }

        out.close();
    }

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
       BufferedReader br;
       StringTokenizer st;

       public MyScanner() {
          br = new BufferedReader(new InputStreamReader(System.in));
       }

       String next() {
           while (st == null || !st.hasMoreElements()) {
               try {
                   st = new StringTokenizer(br.readLine());
               } catch (IOException e) {
                   e.printStackTrace();
               }
           }
           return st.nextToken();
       }

       int nextInt() {
           return Integer.parseInt(next());
       }

       long nextLong() {
           return Long.parseLong(next());
       }

       double nextDouble() {
           return Double.parseDouble(next());
       }

       String nextLine(){
           String str = "";
       try {
          str = br.readLine();
       } catch (IOException e) {
          e.printStackTrace();
       }
       return str;
       }

    }
    //--------------------------------------------------------
 }


import java.util.*;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int i=0;i<t;i++) {
			int x = sc.nextInt();
			if(360%(180-x)==0) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}

	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1024*1024)
	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var a, b, n, s int
		fmt.Fscan(in, &a, &b, &n, &s)
		if a > s/n {
			a = s / n
		}
		s -= a * n
		if s > b {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}

	}
}


package main

import "fmt"

func main() {
	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var a, b, n, s int
		fmt.Scan(&a, &b, &n, &s)
		if a > s/n {
			a = s / n
		}
		s -= a * n
		if s > b {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}

	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var q int
	fmt.Fscan(in, &q)
	for i := 0; i < q; i++ {
		var a, b, n, s int
		fmt.Fscan(in, &a, &b, &n, &s)
		if a > s/n {
			a = s / n
		}
		s -= a * n
		if s > b {
			fmt.Fprint(out, "NO\n")
		} else {
			fmt.Fprint(out, "YES\n")
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main() {
	for t := ScanInt64(); t > 0; t-- {
		a, b, n, s := ScanInt64(), ScanInt64(), ScanInt64(), ScanInt64()
		paymentWithoutExchange(a, b, n, s)
	}
	close(O)
	oWg.Wait()
}

func paymentWithoutExchange(a, b, n, s int64) {
	m := Min(s/n, a)
	if (s - (m * n)) <= b {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
func Min(args ...int64) int64 {
	minVal := MX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var Pl func(a ...interface{}) (n int, err error)

func init() {
	Pl = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt() int {
	intStr := ScanWord()
	i, err := strconv.Atoi(intStr)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int64) []int64 {
	length := int(n)
	arr := make([]int64, n)
	for i := 0; i < length; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Mx(args ...int64) int64 {
	maxVal := MN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Mn(args ...int64) int64 {
	minVal := MX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func S(v interface{}) string {
	return fmt.Sprintf("%s", v)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func solve() {
	q := readInt32()
	for i := 0; i < q; i++ {
		a := readInt32()
		b := readInt32()
		n := readInt32()
		s := readInt32()

		if a * n > s {
			tmp := int(math.Ceil(float64(s) / float64(n)))
			if s - tmp <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		} else {
			if s - a*n <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		}
		ln()
	}
}

/*   Helping stuff   */
type pair struct {
	a, b int
}

func newPair(a, b int) pair {
	return pair{a, b}
}

func mod(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a > b {
		a = b
	}
	return a
}

func max(a, b int) int {
	if a < b {
		a = b
	}
	return a
}

func main() {
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	solve()
}

/*   Scanner   */
var in *bufio.Reader
var out *bufio.Writer
var stringParts []string

func readLine() string {
	str, _, _ := in.ReadLine()
	return string(str)
}

func readNext() string {
	if len(stringParts) == 0 {
		stringParts = strings.Split(readLine(), " ")
	}
	res := stringParts[0]
	stringParts = stringParts[1:]
	return res
}

func readInt32() int {
	res, _ := strconv.ParseInt(readNext(), 10, 32)
	return int(res)
}

func readInt64() int64 {
	res, _ := strconv.ParseInt(readNext(), 10, 64)
	return res
}

func readFloat32() float32 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return float32(res)
}

func readFloat64() float64 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return res
}

func writeString(s interface{}) {
	out.WriteString(fmt.Sprintf("%v ", s))
	out.Flush()
}

func writeSlice(s interface{}) {
	writeString(strings.Trim(strings.Join(strings.Split(fmt.Sprint(s), " "), " "), "[]"))
}

func ln() {
	out.Write([]byte{'\n'})
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func solve() {
	q := readInt32()
	for i := 0; i < q; i++ {
		a := readInt32()
		b := readInt32()
		n := readInt32()
		s := readInt32()

		x := min(int(math.Floor(float64(s)/float64(n))), a)
		y := s - x*n

		if x <= a && y <= b && s == x*n + y {
			writeString("YES")
		} else {
			writeString("NO")
		}
		ln()
	}
}

/*   Helping stuff   */
type pair struct {
	a, b int
}

func newPair(a, b int) pair {
	return pair{a, b}
}

func mod(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a > b {
		a = b
	}
	return a
}

func max(a, b int) int {
	if a < b {
		a = b
	}
	return a
}

func main() {
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	solve()
}

/*   Scanner   */
var in *bufio.Reader
var out *bufio.Writer
var stringParts []string

func readLine() string {
	str, _, _ := in.ReadLine()
	return string(str)
}

func readNext() string {
	if len(stringParts) == 0 {
		stringParts = strings.Split(readLine(), " ")
	}
	res := stringParts[0]
	stringParts = stringParts[1:]
	return res
}

func readInt32() int {
	res, _ := strconv.ParseInt(readNext(), 10, 32)
	return int(res)
}

func readInt64() int64 {
	res, _ := strconv.ParseInt(readNext(), 10, 64)
	return res
}

func readFloat32() float32 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return float32(res)
}

func readFloat64() float64 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return res
}

func writeString(s interface{}) {
	out.WriteString(fmt.Sprintf("%v ", s))
	out.Flush()
}

func writeSlice(s interface{}) {
	writeString(strings.Trim(strings.Join(strings.Split(fmt.Sprint(s), " "), " "), "[]"))
}

func ln() {
	out.Write([]byte{'\n'})
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func solve() {
	q := readInt32()
	for i := 0; i < q; i++ {
		a := readInt32()
		b := readInt32()
		n := readInt32()
		s := readInt32()

		if a*n > s {
			if s%n <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		} else {
			if s-a*n <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		}
		ln()
	}
}

/*   Helping stuff   */
type pair struct {
	a, b int
}

func newPair(a, b int) pair {
	return pair{a, b}
}

func mod(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a > b {
		a = b
	}
	return a
}

func max(a, b int) int {
	if a < b {
		a = b
	}
	return a
}

func main() {
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	solve()
}

/*   Scanner   */
var in *bufio.Reader
var out *bufio.Writer
var stringParts []string

func readLine() string {
	str, _, _ := in.ReadLine()
	return string(str)
}

func readNext() string {
	if len(stringParts) == 0 {
		stringParts = strings.Split(readLine(), " ")
	}
	res := stringParts[0]
	stringParts = stringParts[1:]
	return res
}

func readInt32() int {
	res, _ := strconv.ParseInt(readNext(), 10, 32)
	return int(res)
}

func readInt64() int64 {
	res, _ := strconv.ParseInt(readNext(), 10, 64)
	return res
}

func readFloat32() float32 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return float32(res)
}

func readFloat64() float64 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return res
}

func writeString(s interface{}) {
	out.WriteString(fmt.Sprintf("%v ", s))
	out.Flush()
}

func writeSlice(s interface{}) {
	writeString(strings.Trim(strings.Join(strings.Split(fmt.Sprint(s), " "), " "), "[]"))
}

func ln() {
	out.Write([]byte{'\n'})
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func solve() {
	q := readInt32()
	for i := 0; i < q; i++ {
		a := readInt32()
		b := readInt32()
		n := readInt32()
		s := readInt32()

		if a * n > s {
			tmp := int(s / n)
			if s - tmp <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		} else {
			if s - a*n <= b {
				writeString("YES")
			} else {
				writeString("NO")
			}
		}
		ln()
	}
}

/*   Helping stuff   */
type pair struct {
	a, b int
}

func newPair(a, b int) pair {
	return pair{a, b}
}

func mod(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a > b {
		a = b
	}
	return a
}

func max(a, b int) int {
	if a < b {
		a = b
	}
	return a
}

func main() {
	in = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	solve()
}

/*   Scanner   */
var in *bufio.Reader
var out *bufio.Writer
var stringParts []string

func readLine() string {
	str, _, _ := in.ReadLine()
	return string(str)
}

func readNext() string {
	if len(stringParts) == 0 {
		stringParts = strings.Split(readLine(), " ")
	}
	res := stringParts[0]
	stringParts = stringParts[1:]
	return res
}

func readInt32() int {
	res, _ := strconv.ParseInt(readNext(), 10, 32)
	return int(res)
}

func readInt64() int64 {
	res, _ := strconv.ParseInt(readNext(), 10, 64)
	return res
}

func readFloat32() float32 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return float32(res)
}

func readFloat64() float64 {
	res, _ := strconv.ParseFloat(readNext(), 32)
	return res
}

func writeString(s interface{}) {
	out.WriteString(fmt.Sprintf("%v ", s))
	out.Flush()
}

func writeSlice(s interface{}) {
	writeString(strings.Trim(strings.Join(strings.Split(fmt.Sprint(s), " "), " "), "[]"))
}

func ln() {
	out.Write([]byte{'\n'})
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var T int
	scanf("%d\n", &T)

	for cas := 1; cas <= T; cas++ {
		var a, b, n, s int64
		scanf("%v %v %v %v\n", &a, &b, &n, &s)

		if a*n+b >= s {
			var left int64
			if a*n <= s {
				left = s - a*n
			} else {
				left = s - s/n*n
			}
			if left <= b {
				printf("YES\n")
			} else {
				printf("NO\n")
			}
		} else {
			printf("NO\n")
			continue
		}
	}
}


package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		// str := strconv.FormatInt(A[i], 10)  // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var q int

func main() {
	q = ReadInt()

	for tc := 0; tc < q; tc++ {
		a, b, n, s := ReadInt64_4()
		x := s / n

		if x <= a && (s-x*n) <= b {
			fmt.Println("YES")
		} else if x > a && (s-a*n) <= b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

/*******************************************************************/


q = int(input())
for t in range(q):
    a, b, n, S = map(int, input().split())
    tempA = S // n
    if tempA <= a:
        a = tempA
    if (S - a*n) > b:
        print("NO")
    else:
        print("YES")


package main

import (
  "bufio"
  "fmt"
  "os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var q int
	fmt.Scanf("%d\n", &q)
	for t := q; t > 0; t-- {
		var a, b, n, S int64
		scanf("%d %d %d %d\n", &a, &b, &n, &S)
		altA := S / n
		if altA <= a {
			a = altA
		}
		if (S - a*n) > b {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}


package main

import (
  "bufio"
  "fmt"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var q int
	fmt.Scanf("%d\n", &q)
	for t := q; t > 0; t-- {
		var a, b, n, S int64
		scanf("%d %d %d %d\n", &a, &b, &n, &S)
		altA := S / n
		if altA <= a {
			a = altA
		}
		if (S - a*n) > b {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}


package main

import "fmt"

func main() {
	var q int
	fmt.Scanf("%d\n", &q)
	for t := q; t > 0; t-- {
		var a, b, n, S int64
		fmt.Scanf("%d %d %d %d\n", &a, &b, &n, &S)
		altA := S / n
		if altA <= a {
			a = altA
		}
		if (S - a*n) > b {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var q int
	var a, b, n, s int64
	fmt.Fscanln(reader, &q)
	for i := 0; i < q; i++ {
		fmt.Fscanln(reader, &a, &b, &n, &s)
		if s%n > b {
			fmt.Fprintln(writer, "NO")
			continue
		}
		if s/n > a && s-n*a > b {
			fmt.Fprintln(writer, "NO")
			continue
		}
		fmt.Fprintln(writer, "YES")
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a, b, n, S int
		scanf("%d %d %d %d\n", &a, &b, &n, &S)
		tmp := min(a, S/n)*a + b
		if tmp >= 0 {
			fmt.Println("YES");
		} else {
			fmt.Println("NO");
		}
	}

}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a, b, n, S int
		scanf("%d %d %d %d\n", &a, &b, &n, &S)
		tmp := min(a, S/n)*n + b
		if tmp >= S {
			fmt.Println("YES");
		} else {
			fmt.Println("NO");
		}
	}

}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var a, b, n, S int
		scanf("%d %d %d %d\n", &a, &b, &n, &S)
		tmp := min(a, S/n)*n + b
		if tmp >= 0 {
			fmt.Println("YES");
		} else {
			fmt.Println("NO");
		}
	}

}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	countStr, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	count, err := strconv.Atoi(strings.TrimSpace(countStr))
	if err != nil {
		panic(err)
	}

	for i := 0; i < count; i++ {
		text, _ := reader.ReadString('\n')
		strs := strings.Split(text, " ")

		nCount, err := strconv.Atoi(strs[0])
		if err != nil {
			panic(err)
		}
		oneCount, err := strconv.Atoi(strs[1])
		if err != nil {
			panic(err)
		}
		nValue, err := strconv.Atoi(strs[2])
		if err != nil {
			panic(err)
		}
		S, err := strconv.Atoi(strings.TrimSpace(strs[3]))
		if err != nil {
			panic(err)
		}

		// fmt.Println(strs[3], nCount, oneCount, nValue, S)
		nSum := nValue * nCount
		// S / nValue
		if nSum <= S {
			if S-nSum <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		} else {
			// fmt.Println("S/nValue", S/nValue)
			if S-(S/nValue)*nValue <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}
	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	countStr, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	count, err := strconv.Atoi(strings.TrimSpace(countStr))
	if err != nil {
		panic(err)
	}

	for i := 0; i < count; i++ {
		text, _ := reader.ReadString('\n')
		strs := strings.Split(text, " ")

		nCount, err := strconv.Atoi(strs[0])
		if err != nil {
			panic(err)
		}
		oneCount, err := strconv.Atoi(strs[1])
		if err != nil {
			panic(err)
		}
		nValue, err := strconv.Atoi(strs[2])
		if err != nil {
			panic(err)
		}
		S, err := strconv.Atoi(strings.TrimSpace(strs[3]))
		if err != nil {
			panic(err)
		}

		// fmt.Println(strs[3], nCount, oneCount, nValue, S)
		nSum := nValue * nCount
		// S / nValue
		if nSum <= S {
			if S-nSum <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		} else {
			if S-(S/nValue)*nCount <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}
	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	countStr, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	count, err := strconv.Atoi(strings.TrimSpace(countStr))
	if err != nil {
		panic(err)
	}

	for i := 0; i < count; i++ {
		text, _ := reader.ReadString('\n')
		strs := strings.Split(text, " ")

		nCount, err := strconv.Atoi(strs[0])
		if err != nil {
			panic(err)
		}
		oneCount, err := strconv.Atoi(strs[1])
		if err != nil {
			panic(err)
		}
		nValue, err := strconv.Atoi(strs[2])
		if err != nil {
			panic(err)
		}
		S, err := strconv.Atoi(strings.TrimSpace(strs[3]))
		if err != nil {
			panic(err)
		}

		// fmt.Println(strs[3], nCount, oneCount, nValue, S)
		nSum := nValue * nCount
		// S / nValue
		if nSum <= S {
			if S-nSum <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		} else {
			// fmt.Println("S/nValue", S/nValue)
			r := (S / nValue) * nValue
			if r > nCount {
				fmt.Println("NO")
				continue
			}
			if S-r <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}
	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	countStr, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	count, err := strconv.Atoi(strings.TrimSpace(countStr))
	if err != nil {
		panic(err)
	}

	for i := 0; i < count; i++ {
		text, _ := reader.ReadString('\n')
		strs := strings.Split(text, " ")

		nCount, _ := strconv.ParseInt(strs[0], 10, 64)
		oneCount, _ := strconv.ParseInt(strs[1], 10, 64)
		nValue, _ := strconv.ParseInt(strs[2], 10, 64)
		S, _ := strconv.ParseInt(strings.TrimSpace(strs[3]), 10, 64)

		nSum := nValue * nCount

		if nSum <= S {
			if S-nSum <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		} else {
			// fmt.Println("S/nValue", S/nValue)
			r := S / nValue
			if S-r*nValue <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}
	}

}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	countStr, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	count, err := strconv.Atoi(strings.TrimSpace(countStr))
	if err != nil {
		panic(err)
	}

	for i := 0; i < count; i++ {
		text, _ := reader.ReadString('\n')
		strs := strings.Split(text, " ")

		nCount, err := strconv.Atoi(strs[0])
		if err != nil {
			panic(err)
		}
		oneCount, err := strconv.Atoi(strs[1])
		if err != nil {
			panic(err)
		}
		nValue, err := strconv.Atoi(strs[2])
		if err != nil {
			panic(err)
		}
		S, err := strconv.Atoi(strings.TrimSpace(strs[3]))
		if err != nil {
			panic(err)
		}

		// fmt.Println(strs[3], nCount, oneCount, nValue, S)
		nSum := nValue * nCount
		// S / nValue
		if nSum <= S {
			if S-nSum <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		} else {
			// fmt.Println("S/nValue", S/nValue)
			r := S / nValue
			if r > nCount {
				fmt.Println("NO")
				continue
			}
			if S-r*nValue <= oneCount {
				fmt.Println("YES")
				continue
			}
			fmt.Println("NO")
			continue
		}
	}

}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main() {
	for t := ScanInt64(); t > 0; t-- {
		a, b, n, s := ScanInt64(), ScanInt64(), ScanInt64(), ScanInt64()

		if (a * n) <= s {
			if s-(a*n) <= b {
				O <- "YES"
			} else {
				O <- "NO"
			}
		} else {
			s = s % n
			if s <= b {
				O <- "YES"
			} else {
				O <- "NO"
			}
		}
	}
	close(O)
	oWg.Wait()
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var Pl func(a ...interface{}) (n int, err error)

func init() {
	Pl = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt() int {
	intStr := ScanWord()
	i, err := strconv.Atoi(intStr)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Mx(args ...int64) int64 {
	maxVal := MN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Mn(args ...int64) int64 {
	minVal := MX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func S(v interface{}) string {
	return fmt.Sprintf("%s", v)
}


package main

import (
	"fmt"
	"os"
	"bufio"
)

func min ( a int, b int ) int{
	if a > b{
		return b
	}
	return a
}

func main() {
	var t, a, b, n, s int
	in := bufio.NewReader ( os.Stdin )
	fmt.Fscan ( in, &t )
	for t > 0 {
		t--
		fmt.Fscan ( in, &a, &b, &n, &s )
		if b >= s {
			fmt.Println ( "Yes" )
			continue
		}

		d := s / n;
		if d <= a && s % n <= b {
			fmt.Println ( "Yes" )
			continue
		}
		d = min ( d, a );
		if s - n * d <= b {
			fmt.Println ( "Yes" )
			continue
		}
		fmt.Println ( "No" )
	}
}


package main

import (
	"fmt"
)

func min ( a int, b int ) int{
	if a > b{
		return b
	}
	return a
}

func main() {
	var t, a, b, n, s int
	fmt.Scanf ( "%d\n", &t )
	for t > 0 {
		t--
		fmt.Scanf ( "%d %d %d %d\n", &a, &b, &n, &s )
		fmt.Println ( a, b, n, s )
		if b >= s {
			fmt.Println ( "Yes" )
			continue
		}

		d := s / n;
		if d <= a && s % n <= b {
			fmt.Println ( "Yes" )
			continue
		}
		d = min ( d, a );
		if s - n * d <= b {
			fmt.Println ( "Yes" )
			continue
		}
		fmt.Println ( "No" )
	}
}


package main

import (
	"fmt"
)

func min ( a int, b int ) int{
	if a > b{
		return b
	}
	return a
}

func main() {
	var t, a, b, n, s int
	fmt.Scanf ( "%d\n", &t )
	for t > 0 {
		t--
		fmt.Scanf ( "%d %d %d %d\n", &a, &b, &n, &s )
		if b >= s {
			fmt.Println ( "Yes" )
			continue
		}

		d := s / n;
		if d <= a && s % n <= b {
			fmt.Println ( "Yes" )
			continue
		}
		d = min ( d, a );
		if s - n * d <= b {
			fmt.Println ( "Yes" )
			continue
		}
		fmt.Println ( "No" )
	}
}


package main

import (
	"fmt"
)

func min ( a int, b int ) int {
	if a > b {
		return b
	}
	return a
}

func main() {
	var y, b, r int
	fmt.Scanf ( "%d %d %d\n", &y, &b, &r )
	b--; r -= 2
	fmt.Println ( min ( min ( y, b ), r ) * 3 + 3 )
}


package main

import (
	"fmt"
	"os"
	"bufio"
)

func min ( a int, b int ) int{
	if a > b{
		return b
	}
	return a
}

func main() {
	var t, a, b, n, s int
	var ans string
	in := bufio.NewReader ( os.Stdin )
	fmt.Fscan ( in, &t )
	for t > 0 {
		t--
		fmt.Fscan ( in, &a, &b, &n, &s )
		if b >= s {
			ans += "Yes\n"
			continue
		}

		d := s / n;
		if d <= a && s % n <= b {
			ans += "Yes\n"
			continue
		}
		d = min ( d, a );
		if s - n * d <= b {
			ans += "Yes\n"
			continue
		}
		ans += "No\n"
	}

	fmt.Printf ( ans );
}


// Author: sighduck
// URL: https://codeforces.com/contest/1256/problem/A

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func Solve(a, b, n, S int) string {
	m := min(a, S/n)
	rem := S - m*n
	if b >= rem {
		return "YES"
	}
	return "NO"
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var q int
	fmt.Fscanf(reader, "%d\n", &q)
	for i := 0; i < q; i++ {
		var a, b, n, S int
		fmt.Fscanf(reader, "%d %d %d %d\n", &a, &b, &n, &S)
		fmt.Fprintf(writer, "%s\n", Solve(a, b, n, S))
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var q int

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanln(reader, &q)

	for i := 0; i < q; i++ {
		var a, b, n, S int
		fmt.Fscanln(reader, &a, &b, &n, &S)
		if JudgePossible(a, b, n, S) {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

func JudgePossible(a, b, n, S int) bool {
	to_divide := S / n

	if to_divide > a {
		to_divide = a
	}
	S -= to_divide * n

	if b >= S {
		return true
	}
	return false
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var q, a, b, n, S int64
	_, _ = fmt.Fscanf(reader, "%d\n", &q)
	for q > 0 {
		q--
		_, _ = fmt.Fscanf(reader, "%d %d %d %d\n", &a, &b, &n , &S)

		t := S / n
		if t > a {
			t = a
		}

		//fmt.Printf("t := %d, S - t * n = %d, b %d \n", t, S - t * n, b)

		if b >= S - t * n {
			_, _ = writer.Write([]byte("YES\n"))
		} else {
			_, _ = writer.Write([]byte("NO\n"))
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func fun() {
	var a, b, n, s int64
	scanf("%d %d %d %d\n", &a, &b, &n, &s)
	printf("%s\n", solve(a, b, n, s))
}

func solve(a, b, n, s int64) string {
	if s > (n*a + b) {
		return "NO"
	}
	if s%n > b {
		return "NO"
	}
	return "YES"
}

func main() {
	// Flush stdout
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fun()
	}
}


<?php
$a = trim(fgets(STDIN));
for($x = 1; $x <= $a; $x++)
{
     list($b, $c, $d, $e) = explode(" ", trim(fgets(STDIN)));
     if($d < $e)
     {
          $f = floor($e / $d);
          $g = $e % $d;
          $e -= $d * min($b, $f);
          if($c >= $e)
          {
               print "YES\n";
          }
          else
          {
               print "NO\n";
          }
     }
     elseif($d == $e)
     {
          print "YES\n";
     }
     elseif($d > $e)
     {
          if($c >= $e)
          {
               print "YES\n";
          }
          else
          {
               print "NO\n";
          }
     }
}
?>


<?php
list($c) = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $c; $i++) {
    $aArray = explode(' ', trim(fgets(STDIN)));
    $iAvg = floor($aArray[3]/$aArray[2]);
    if ($iAvg <= $aArray[0]) {
        if (($iAvg*$aArray[2] + $aArray[1]) >= $aArray[3]){
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    } else {
        echo "NO\n";
    }
}


<?php
list($c) = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $c; $i++) {
    $aArray = explode(' ', trim(fgets(STDIN)));
    $iAvg = floor($aArray[3]/$aArray[2]);
    if ($iAvg <= $aArray[0]) {
        if (($iAvg*$aArray[2] + $aArray[1]) >= $aArray[3]){
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    } elseif ($iAvg > $aArray[0]) {
        if(($aArray[0]*$aArray[2] + $aArray[1]) >= $aArray[3]){
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    } else {
        echo "NO\n";
    }
}


<?php
list($c) = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $c; $i++) {
    $aArray = explode(' ', trim(fgets(STDIN)));
    if (floor($aArray[3]/$aArray[2]) <= $aArray[0]) {
        if ((floor($aArray[3]/$aArray[2])*$aArray[2] + $aArray[1]) >= $aArray[3]){
            echo "YES\n";
        } else {
            echo "NO\n";
        }
    } else {
        echo "NO\n";
    }
}


<?php
$count = fgets(STDIN);
for ($i = 0; $i < $count; $i++){
	list($a, $b, $n, $S) = explode(' ', fgets(STDIN));
	if($a * $n < $S){
		printf("%s\n", $a * $n + $b >= $S ? 'YES':'NO');
	} else {
		printf("%s\n", $b >= $S % $n ? 'YES':'NO');
	}
}


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = explode(" ", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;

    if (intval($s / $n) <= $a && $s % $n <= $b) {
        $status = true;
    } else if (intval($s / $n) > $a && $s - ($a * $n) <= $b) {
        $status = true;
    }
   /*if ($a == 0 && $b >= $s) {
        $status = true;
    } elseif ($b == 0 && $s%$n == 0 && intval($s/$n) <= $a) {
        $status = true;
    } else {
       if ($s % $n <= $b && intval($s / $n) <= $a) {
           $status = true;
       }
   }*/

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;

    if ($s % $n <= $b && intval($s / $n) <= $a) {
        $status = true;
    }
   /*if ($a == 0 && $b >= $s) {
        $status = true;
    } elseif ($b == 0 && $s%$n == 0 && intval($s/$n) <= $a) {
        $status = true;
    } else {
       if ($s % $n <= $b && intval($s / $n) <= $a) {
           $status = true;
       }
   }*/

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;
    for ($j = 1; $j <= $a; $j ++) {
        $count1 = intval(bcdiv ($s,bcmul($n, $j)));
        $count2 = bcmod ($s,bcmul ($n, $j)) ;
        if ( bccomp($count1, $a) !=1 && bccomp($count2, $b) !=1) {
            $status = true;
            break;
        }
    }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;

    if ($a == 0 && $b >= $s) {
        $status = true;
    } elseif ($b == 0 && bcmod($s,$n) == 0 && bcdiv($s,$n) <= $a) {
        $status = true;
    } else {
        for ($j = 1; $j <= $a; $j ++) {
            $count1 = intval(bcdiv ($s, bcmul($n, $j)));
            $count2 = bcmod ($s,bcmul ($n, $j)) ;
            if ( bccomp($count1, $a) !=1 && bccomp($count2, $b) !=1) {
                $status = true;
                break;
            }
        }
    }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;
    for ($j = 1; $j <= $a; $j ++) {
        $count1 = intval(bcdiv ($s,bcmul($n, $j)));
        $count2 = bcmod ($s,bcmul ($n, $j)) ;
        if ( $count1 <= $a && $count2  <= $b) {
            $status = true;
            break;
        }
    }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;
    for ($j = 0; $j <= $a; $j ++) {
        $count1 = intval(bcdiv ($s,bcmul($n, $j)));
        $count2 = bcmod ($s,bcmul ($n, $j)) ;
        if ( bccomp($count1, $a) !=1 && bccomp($count2, $b) !=1) {
            $status = true;
            break;
        }
    }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;

    if ($a == 0 && $b >= $s) {
        $status = true;
    } elseif ($b == 0 && bcmod($s,$n) == 0 && bcdiv($s,$n) <= $a) {
        $status = true;
    } else {
        if ($s % $n <= $b && intval($s / $n) <= $a) {
            $status = true;
        }
    }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


<?php
$q = trim(fgets(STDIN));

for ($i=0; $i < $q; $i++) {
    $str = trim(fgets(STDIN));
    $aR = preg_split("/[\s,]+/", $str);
    $a = $aR[0];
    $b = $aR[1];
    $n = $aR[2];
    $s = $aR[3];
    $status = false;

   if ($a == 0 && $b >= $s) {
        $status = true;
    } elseif ($b == 0 && $s%$n == 0 && intval($s/$n) <= $a) {
        $status = true;
    } else {
       if ($s % $n <= $b && intval($s / $n) <= $a) {
           $status = true;
       }
   }

    if ($status) {
        echo "YES\n";
    } else {
        echo "NO\n";
    }
}
?>


q = int(raw_input())

for _ in range(q):
    a, b, n, S = map(int, raw_input().split())
    if b >= S:
        print "YES"
        continue
    total = S
    need = S/n
    if need <= a:
        total -= need * n
    else:
        total -= a * n
    if b < total:
        print "NO"
    else:
        print "YES"


q = input()
for _ in xrange(q):
    a,b,n,s = map(int, raw_input().split())
    x = s/n
    total = min(x,a)*n
    remain = s-total
    if b>=remain:
        print "YES"
    else:
        print "NO"


#!/usr/bin/env python

from sys import stdin, stderr

def check(a, b, n, S):
   aa = min(S // n, a)
   S -= aa * n
   return S <= b

def main():
   TC = int(stdin.readline())
   ans = []
   for tc in xrange(TC):
      a, b, n, S = map(int, stdin.readline().split())
      ans.append( 'YES' if check(a, b, n, S) else 'NO' )
   print('\n'.join(ans))

   return 0

if __name__ == '__main__': main()


for _ in range(input()):
    a,b,n,s=map(int,raw_input().split())
    x=s/n
    x=min(x,a)
    s=s-x*n
    if s>=b:
        print 'YES'
    else:
        print 'NO'


for _ in range(input()):
    a,b,n,s=map(int,raw_input().split())
    x=s/n
    x=min(x,a)
    s=s-x*n
    if b>=s:
        print 'YES'
    else:
        print 'NO'


#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
import math
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def main():
	for _ in range(int(input())):
		a, b, n, s = map(int, input().split())
		if s%n <= b:
			s -= s%n
			b -= b%n
			s -= a*n
			s -= b
			if s <= 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()


#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
import math
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def main():
	for _ in range(int(input())):
		a, b, n, s = map(int, input().split())
		if s%n <= b and s//n <= a:
			print('YES')
		else:
			print('NO')

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()


#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
import math
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def main():
	for _ in range(int(input())):
		a, b, n, s = map(int, input().split())
		if s%n <= b:
			temp = s%n
			s -= temp
			b -= temp
			s -= a*n
			s -= b
			if s <= 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()


import sys,os,math
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import Queue

# sys.stdin = open('input')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())

def main():
    q = map(int, raw_input().split())[0]
    for i in range(q):
        a, b, n, s = map(int, raw_input().split())
        nn = s/n
        if nn<=a:
            s -= s/n*n
        else:
            s -= a*n
        if s>b:
            print 'NO'
        else:
            print 'YES'
main()


import math
cases = input()
ans = []
for i in range(cases):
    data = list(map(int, raw_input().split()))
    a, b, n, S = data[0], data[1], data[2], data[3]
    S -= min(a, math.floor(S / n)) * n
    if (S <= b):
        ans.append("YES")
    else:
        ans.append("NO")
for i in ans:
    print (i)


import math
cases = input()
ans = []
for i in range(cases):
    data = list(map(int, raw_input().split()))
    a, b, n, S = data[0], data[1], data[2], data[3]
    if (b >= S%n):
        S -= S%n
        S -= math.floor(b / n)* n
    if S % n == 0 and S / n <= a:
        ans.append("YES")
    else:
        ans.append("NO")
for i in ans:
    print (i)


cases = input()
ans = []
for i in range(cases):
    data = list(map(int, raw_input().split()))
    a, b, n, S = data[0], data[1], data[2], data[3]
    S -= b - S%n
    if S - S % n <= a * n:
        ans.append("YES")
    else:
        ans.append("NO")
for i in ans:
    print (i)


import math
cases = input()
ans = []
for i in range(cases):
    data = list(map(int, raw_input().split()))
    a, b, n, S = data[0], data[1], data[2], data[3]
    if (b >= S%n):
        S -= S%n
        b -= S % n
        S -= math.floor(b / n)* n
    if S % n == 0 and S <= a * n:
        ans.append("YES")
    else:
        ans.append("NO")
for i in ans:
    print (i)


cases = input()
ans = []
for i in range(cases):
    data = list(map(int, raw_input().split()))
    a, b, n, S = data[0], data[1], data[2], data[3]
    if S % n <= b and S - S % n <= a * n:
        ans.append("YES")
    else:
        ans.append("NO")
for i in ans:
    print (i)


import math

q = input()
for i in range(q):
    a,b,n,S = list(map(int,raw_input().split()))
    sumMax = n*a + b
    s = sumMax - S
    if s>=0:
        if s%n<=b:
            print "YES"
        else:
            print "NO"
    else:
        print "NO"


import math

q = input()
for i in range(q):
    a,b,n,S = list(map(int,raw_input().split()))
    y = S-n*a
    if n*a + b >= S:
        if y>=0 and y<=b:
            print "YES"
        else:
            k = math.floor(-y/n)
            if y%n:
                k = k+1
            if a>=k:
                y = y + n*k
                if y<=b:
                    print "YES"
                    continue
                else:
                    print "NO"
                    continue
            else:
                print "NO"
                continue
    else:
        print "NO"


q = input()

for i in range(q):
    a,b,n,S = list(map(int,raw_input().split()))
    y = S-n*a
    if y>=0 and y<=b:
        print "YES"
    elif (-y)%n:
        k = (-y)//n
        if a>k and k>=1:
            print "YES"
        else:
            print "NO"
    else:
        print "NO"


q = input()

for i in range(q):
    a,b,n,S = list(map(int,raw_input().split()))
    y = S-n*a
    if y>=0 and y<=b:
        print "YES"
    else:
        k = (-y)//n
        if a>=k+1:
            k = k+1
            y = y + n*k
            if y<=b:
                print "YES"
            else:
                print "NO"
        else:
            print "NO"


q = input()

for i in range(q):
    a,b,n,S = list(map(int,raw_input().split()))
    y = S-n*a
    if y>=0 and y<=b:
        print "YES"
    else:
        k = (-y)//n
        if a>=k+1 and k>=1:
            k = k+1
            y = y + n*k
            if y<=b:
                print "YES"
            else:
                print "NO"
        else:
            print "NO"


for q in range(input()):

    a,b,n,s=map(int,raw_input().split())
    a+=b/n
    b%=n
    if s/n<=a and s%n<=b:
        print 'YES'
    else:
        print 'NO'


for q in range(input()):

    a,b,n,s=map(int,raw_input().split())
    a-=(s/n)
    s/=n
    if a<0:
        c=(-a)/n+int(((-a)%n)!=0)
        b-=c*n
        a+=c

    if a<0 or b<0 or s>b:
        print 'NO'
    else:
        print 'YES'


for q in range(input()):

    a,b,n,s=map(int,raw_input().split())
    if s/n<=a and s%n<=b:
        print 'YES'
    else:
        print 'NO'


for q in range(input()):

    a,b,n,s=map(int,raw_input().split())
    b-=s%n
    if b<0:
        print 'NO'
        continue
    tot=a*n+b
    if tot<(s-s%n):
        print 'NO'
    else:
        print 'YES'


#!/usr/bin/env python
from __future__ import division, print_function

import os
import 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 main():
    q = int(input())

    for _ in range(q):
        a, b, n, s = map(int, input().split())

        c1 = min(s // n, a)
        print("YES" if b >= s - (c1 * n) else "NO")

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    main()


for i3 in xrange(input()):
    a,b,n,s=map(int,raw_input().split())
    print ["yes","no"][(s-min(a,s/n)*n)>b]


for _ in range(input()):
    a,b,n,S = map(int,raw_input().split())
    max_n = min(S/n,a)*n
    left = S - max_n
    if left <= b:
        print 'YES'
    else:
        print 'NO'


input = raw_input
range = xrange
def answer():
    a, b, n, s = map(int, input().split(" "))
    ss = s % n

    if ss > b:
        return "NO"

    ys = []
    y = ss
    for sss in range(ss, b+1, n):
        if s - ss < 0:
            break
        y = sss

    x = (s - y) // n
    #print("s", s, "n", n, "x", x, "y", y)

    if 0 <= x <= a:
        return "YES"
    else:
        return "NO"

_ = int(input())

for __ in range(_):
    out = answer()
    print(out)


input = raw_input
range = xrange
def answer():
    a, b, n, s = map(int, input().split(" "))
    ss = s % n

    ys = []
    y = ss
    min_bs = min(b, s)

    if ss > min_bs:
        return "NO"

    tmp = min_bs - ss

    if tmp % n == 0:
        c = tmp // n
    else:
        c = tmp // n
    #print("tmp", tmp, "c", c)
    y = ss + c* n

    #for sss in range(ss, b+1, n):
    #    if s - sss < 0:
    #        break
    #    y = sss

    x = (s - y) // n
    #print("s", s, "n", n, "x", x, "y", y)

    if 0 <= x <= a:
        return "YES"
    else:
        return "NO"

_ = int(input())

for __ in range(_):
    out = answer()
    print(out)


input = raw_input
range = xrange
def answer():
    a, b, n, s = map(int, input().split(" "))
    ss = s % n

    if ss > b:
        return "NO"

    ys = []
    y = ss
    for sss in range(ss, b, n):
        if s - ss < 0:
            break
        y = sss

    x = (s - y) // n
    #print("s", s, "n", n, "x", x, "y", y)

    if 0 <= x <= a:
        return "YES"
    else:
        return "NO"

_ = int(input())

for __ in range(_):
    out = answer()
    print(out)


input = raw_input
range = xrange
def answer():
    a, b, n, s = map(int, input().split(" "))
    ss = s % n

    if ss > b:
        return "NO"

    ys = []
    y = ss
    for sss in range(ss, b+1, n):
        if s - sss < 0:
            break
        y = sss

    x = (s - y) // n
    #print("s", s, "n", n, "x", x, "y", y)

    if 0 <= x <= a:
        return "YES"
    else:
        return "NO"

_ = int(input())

for __ in range(_):
    out = answer()
    print(out)


from __future__ import division, print_function

def main():
    for _ in range(int(input())):
        a, b, n, s = input_as_list()
        rmn = max(s%n, s-a*n)
        print("YES" if b >= rmn else "NO")

INF = float('inf')
MOD = 10 ** 9 + 7
__interactive = False

import os, sys
from atexit import register
from io import BytesIO
import itertools
import __pypy__

if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

mulmod = __pypy__.intop.int_mulmod

if "LOCAL_" in os.environ:
    debug_print = print
else:
    if not __interactive:
        sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
        sys.stdout = BytesIO()
        register(lambda: os.write(1, sys.stdout.getvalue()))

        input = lambda: sys.stdin.readline().rstrip('\r\n')
    debug_print = lambda *x, **y: None

flush = sys.stdout.flush

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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

def input_as_matrix(n, m):
    return [input_as_list() for _ in range(n)]

def array_of(f, *dim):
    return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def range_with_count(start, step, count):
    return range(start, start + step * count, step)

def indices(l, start=0, end=0):
    return range(start, len(l)+end)

def ceil_power_of_2(n):
    """ [0, 1, 2, 4, 4, 8, 8, 8, 8, 16, 16, ...] """
    return 2 ** ((n - 1).bit_length())

def ceil_div(x, r):
    """ = ceil(x / r) """
    return (x + r - 1) // r

main()


#!/usr/bin/python

def check_change(a, b, n, S):
	# check if our variable coins are worth at least S
	if a * n >= S:

		# if so, see if we have enough pennies to reach the total
		if b >= S % n:
			return "YES"

		else:
			return "NO"

	# otherwise check if we have enough combined coins
	elif (a*n) + b >= S:
		return "YES"

	# otherwise it's not possible
	else:
		return "NO"

# Main
q = int(raw_input())
for i in range(q):
	line = [int(x) for x in raw_input().split(" ")]
	a = line[0]
	b = line[1]
	n = line[2]
	S = line[3]

	print check_change(a,b,n,S)


# Author : raj1307 - Raj Singh
# Date   : 4.11.19

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(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations

abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[0]
def sort2(l):return sorted(l, key=getKey)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]

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

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def isPrime(n) : # Check Prime Number or not
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

def main():

    for _ in range(ii()):
        a,b,n,s=mi()

        x=s//n
        c=min(a,x)

        s-=c*n

        if s<=b:
            print('YES')
        else:
            print('NO')

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()


q   = input()
for i in range(q):
    a,b,n,s = map(int,raw_input().split(" "))
    if a >=s/n:
        s = s%n
    else:
        s -= a*n
    if b>=s:
        print "YES"
    else:
        print "NO"


for _ in range(int(raw_input())):
	(a,b,n,s)=map(int,raw_input().split())
	if a*n+b<s:
		print("NO")

	elif a*n<=s:
		print("YES")

	else:
		k=s//n
		s-=k*n
		# print(k,s)
		if s<=b:
			print("YES")

		else:
			print("NO")


import sys
range = xrange
input = raw_input

inp = [int(x) for x in sys.stdin.read().split()]; ii = 0

q = inp[ii]; ii += 1
out = []
for _ in range(q):
    a = inp[ii]; ii += 1
    b = inp[ii]; ii += 1
    n = inp[ii]; ii += 1
    S = inp[ii]; ii += 1

    x = S//n
    y = S%n

    t = max(0, x - a)
    x -= t
    y += n * t

    if x <= a and y <= b:
        out.append('YES')
    else:
        out.append('NO')

print '\n'.join(str(x) for x in out)


q = int(raw_input())
for _ in xrange(q):
    a, b, n, S = map(int, raw_input().split())
    needed = S/float(n)
    if needed > a:
        S -= (a*n)
        if S > b: print "NO"
        else: print "YES"
    elif needed < a:
        S -= (int(needed)*n)
        if S > b: print "NO"
        else: print "YES"
    else: print "YES"


def test(a,b,n,S):
    q,r=divmod(S,n)
    if b<n:
        if 0<=q<=a and 0<=r<=b:
            return True
        return False
    else:
        return S<=a*n+b

n=int(raw_input())

for i in range(n):
    s=raw_input()
    a,b,n,S=map(int,s.split())
    if test(a,b,n,S):
        print 'YES'
    else:
        print 'NO'


q = int(raw_input())
for i in range(q):
    a, b, n, s = tuple(map(int, raw_input().split()))
    if a*n == s:
        print "YES"
        continue
    elif a*n > s:
        if s//n <= b:
            print "YES"
        else:
            print "NO"
    else:
        if (a*n) + b >= s:
            print "YES"
        else:
            print "NO"


q = int(raw_input())
for i in range(q):
    a, b, n, s = tuple(map(int, raw_input().split()))
    if a*n == s:
        print "YES"
        continue
    elif a*n > s:
        if s % n <= b:
            print "YES"
        else:
            print "NO"
    else:
        if (a*n) + b >= s:
            print "YES"
        else:
            print "NO"


from sys import stdin,stdout
for _ in range(int(stdin.readline())):
    # n=int(stdin.readline());
    cns_va,cns1,va,sm=list(map(int,stdin.readline().split()))
    # a=sorted(map(int,stdin.readline().split()))
    req=(sm//va)*va
    if req>sm:req-=va
    diff=sm-req
    if cns_va>=req//va and cns1>=diff:print('YES')
    else:print('NO')


from sys import stdin,stdout
for _ in range(int(stdin.readline())):
    # n=int(stdin.readline());
    cns_va,cns1,va,sm=list(map(int,stdin.readline().split()))
    # a=sorted(map(int,stdin.readline().split()))
    needed=sm//va
    summade=needed*cns_va
    diff=sm-summade
    if cns1>=diff:print('YES')
    else:print('NO')


from sys import stdin,stdout
for _ in range(int(stdin.readline())):
    # n=int(stdin.readline());
    cns_va,cns1,va,sm=list(map(int,stdin.readline().split()))
    # a=sorted(map(int,stdin.readline().split()))
    needed=sm//va
    summade=min(needed,cns_va)*va
    diff=sm-summade
    if cns1>=diff:print('YES')
    else:print('NO')


import java.io.*;
import java.util.*;
import java.math.*;

public class A{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void main(String[] args)throws IOException {			//main method

			int n = readInt();
			int ss = readInt();
			int max = -1;
			while(n-- > 0){
				int s = ss;
				int x = readInt();
				int y = readInt();
				int max2 = 0;
				if(s < x || (s==x && y>0))
					max2 = -1;
				else
				while(true){
				if(x < s && y > 0){
						max2 += 100 - y;
						s = s - (x+1);
						//System.out.print(s+"\n");
				}
				else if(x <= s && y == 0){
						max2 += 0;
						s = s - x;
				}
				else{
					//System.out.print(max2 + "\n");
					break;
				}
				}
				if(max2 > max)max = max2;

			}
			bw.append(max + "\n");

		bw.flush();
		bw.close();
	}

    private static int readInt()throws IOException{		//method for fast input in java
        int n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }

    private static long readLong()throws IOException{		//method for fast input in java
        long n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void main(String[] args)throws IOException {			//main method

			int n = readInt();
			int ss = readInt();
			long maxF = -1;
			while(n-- > 0){
				int x = readInt();
				int y = readInt();
				int a = 0;
				int b = 0;
				long max = -1;

				if(ss < x || (x == ss && y> 0))
					max = -1;
				else
					while(true){
						b = b + y;
						a += x + b/100;
						b = b%100;

						if(a<ss && b > 0){
							max = (100 - b);
						}
						else if(a == ss && b == 0){
							max = 0;
						}
						else{
							//if(maxF < max)maxF = max;
							break;
						}
					}
					if(maxF < max)maxF = max;

			}
bw.append(maxF + "\n");

		bw.flush();
		bw.close();
	}

    private static int readInt()throws IOException{		//method for fast input in java
        int n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }

    private static long readLong()throws IOException{		//method for fast input in java
        long n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void main(String[] args)throws IOException {			//main method

			int n = readInt();
			int ss = readInt();
			long max = -1;
			while(n-- > 0){
				int s = ss;
				int x = readInt();
				int y = readInt();
				long max2 = 0;
				if(s < x || (s==x && y>0))
					max2 = -1;
				else
				while(true){
				if(x < s && y > 0){
						max2 += (100 - y);
						s = s - (x+1);
						//System.out.print(s+"\n");
				}
				else if(x <= s && y == 0){
						max2 += 0;
						s = s - x;
				}
				else{
					//System.out.print(max2 + "\n");
					break;
				}
				}
				if(max2 > max)max = max2;

			}
			bw.append(max + "\n");

		bw.flush();
		bw.close();
	}

    private static int readInt()throws IOException{		//method for fast input in java
        int n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }

    private static long readLong()throws IOException{		//method for fast input in java
        long n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A{
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

	public static void main(String[] args)throws IOException {			//main method

			int n = readInt();
			int s = readInt();
			long maxF = -1;
			while(n-- > 0){
				int x = readInt();
				int y = readInt();
				int max = -1;
				if(s < x || (s == x && y > 0))
					max = -1;
				else{
					if(x < s && y > 0){
						max = (100 - y);
					}
					else if(x <= s && y == 0)
						max = 0;
				}

				if(maxF < max) maxF = max;

			}
bw.append(maxF + "\n");

		bw.flush();
		bw.close();
	}

    private static int readInt()throws IOException{		//method for fast input in java
        int n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }

    private static long readLong()throws IOException{		//method for fast input in java
        long n=0;
        char ch = (char)br.read();
        int sign = 1;
	    while(ch < '0' || ch > '9'){
		    if(ch == '-')
			    sign = -1;
		    ch = (char)br.read();
	    }
	    while(ch >= '0' && ch <= '9'){
		    n = (n<<3) + (n<<1) + (int)ch - '0';
		    ch = (char)br.read();
	    }
	    n = n*sign;
	    return n;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class a {
    public static class Pair implements Comparable<Pair>{
        int f,s;
        public Pair(int f,int s){
            this.f=f;
            this.s=s;
        }
        @Override
        public int compareTo(Pair o) {
            if(s>o.s){
            return 1;
            }
            return -1;
        }

    };

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s[]=in.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int su=Integer.parseInt(s[1]);
        boolean check=false;
        PriorityQueue<Pair> pq = new PriorityQueue<a.Pair>();
        for (int i = 0; i <n ; i++) {
            s=in.readLine().split(" ");
            if(Integer.parseInt(s[0])<=su){
                check=true;
            }
            pq.add(new Pair(Integer.parseInt(s[0]), Integer.parseInt(s[1])));
        }
        if(check){
        int res=0;
        while(!pq.isEmpty()){
            Pair g = pq.poll();
            if(g.f<=su&&g.s!=0){
                res=g.s;
                break;
            }
        }
        out.println(res);
        }else{
            out.println(-1);
        }

        out.close();

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class a {
    public static class Pair implements Comparable<Pair>{
        int f,s;
        public Pair(int f,int s){
            this.f=f;
            this.s=s;
        }
        @Override
        public int compareTo(Pair o) {
            if(s>o.s){
            return 1;
            }
            return -1;
        }

    };

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s[]=in.readLine().split(" ");
        int n=Integer.parseInt(s[0]);
        int su=Integer.parseInt(s[1]);
        PriorityQueue<Pair> pq = new PriorityQueue<a.Pair>();
        for (int i = 0; i <n ; i++) {
            s=in.readLine().split(" ");
            pq.add(new Pair(Integer.parseInt(s[0]), Integer.parseInt(s[1])));
        }
        int res=-1;
        while(!pq.isEmpty()){
            Pair g = pq.poll();
            if(g.f<=su&&g.s!=0){
                res=g.s;
                break;
            }
        }
        out.println(res);

        out.close();

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class a {
    public static class Pair implements Comparable<Pair> {
        int f, s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        @Override
        public int compareTo(Pair o) {
            if (s > o.s) {
                return 1;
            }
            return -1;
        }

    };

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s[] = in.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int su = Integer.parseInt(s[1]);
        boolean check = false;
        PriorityQueue<Pair> pq = new PriorityQueue<a.Pair>();
        for (int i = 0; i < n; i++) {
            s = in.readLine().split(" ");
            double a=Double.parseDouble(s[0])+(Double.parseDouble(s[1])/100);
            if (a<=(double)su) {
                check = true;
            }
            pq.add(new Pair(Integer.parseInt(s[0]), Integer.parseInt(s[1])));
        }
        if (check) {
            int res = 0;
            while (!pq.isEmpty()) {
                Pair g = pq.poll();
                double a=(double)g.f+((double)g.s/100.0);

                if (g.f <= su && g.s != 0&&a<=(double)su) {
                    res = g.s;
                    break;
                }
            }
            if(res==0){
                out.println(0);
            }else{
                out.println((100-res));
            }
        } else {
            out.println(-1);
        }

        out.close();

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class a {
    public static class Pair implements Comparable<Pair> {
        int f, s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        @Override
        public int compareTo(Pair o) {
            if (s > o.s) {
                return 1;
            }
            return -1;
        }

    };

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s[] = in.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int su = Integer.parseInt(s[1]);
        boolean check = false;
        PriorityQueue<Pair> pq = new PriorityQueue<a.Pair>();
        for (int i = 0; i < n; i++) {
            s = in.readLine().split(" ");
            if ((Double.parseDouble(s[0])+(Double.parseDouble(s[1])/100))<=(double)su) {
                check = true;
            }
            pq.add(new Pair(Integer.parseInt(s[0]), Integer.parseInt(s[1])));
        }
        if (check) {
            int res = 0;
            while (!pq.isEmpty()) {
                Pair g = pq.poll();
                if (g.f <= su && g.s != 0) {
                    res = g.s;
                    break;
                }
            }
            if(res==0){
                out.println(0);
            }else{
                out.println((100-res));
            }
        } else {
            out.println(-1);
        }

        out.close();

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.PriorityQueue;

public class a {
    public static class Pair implements Comparable<Pair> {
        int f, s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        @Override
        public int compareTo(Pair o) {
            if (s > o.s) {
                return 1;
            }
            return -1;
        }

    };

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s[] = in.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int su = Integer.parseInt(s[1]);
        boolean check = false;
        PriorityQueue<Pair> pq = new PriorityQueue<a.Pair>();
        for (int i = 0; i < n; i++) {
            s = in.readLine().split(" ");
            if (Integer.parseInt(s[0]) <= su) {
                check = true;
            }
            pq.add(new Pair(Integer.parseInt(s[0]), Integer.parseInt(s[1])));
        }
        if (check) {
            int res = 0;
            while (!pq.isEmpty()) {
                Pair g = pq.poll();
                if (g.f <= su && g.s != 0) {
                    res = g.s;
                    break;
                }
            }
            if(res==0){
                out.println(0);
            }else{
                out.println((100-res));
            }
        } else {
            out.println(-1);
        }

        out.close();

    }

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int f = 0, sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
				sc.nextInt();
			} else {
				f = 1;
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
				if (sugar[i][0] == s && sugar[i][1] > 0) {
					f = 0;
					sugar[i][0] = 0;
					sugar[i][1] = 101;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0) {
				if (i != 0) {
					if (x - sugar[i][1] > sweets)
						sweets = x - sugar[i][1];
				} else
					sweets = x - sugar[i][1];
			}
		}
		System.out.println(f == 0 && sweets == 0 ? "-1" : sweets);
	}

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
			} else {
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0)
				sweets = x - sugar[i][1];
		}
		System.out.println(sweets == 0 ? "-1" : sweets);
	}

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int f = 0, sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
				sc.nextInt();
			} else {
				f = 1;
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
				if (sugar[i][0] == s && sugar[i][1] > 0) {
					f = 0;
					sugar[i][0] = 0;
					sugar[i][1] = 101;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0) {
				if (i != 0) {
					if (x - sugar[i][1] > sweets)
						sweets = x - sugar[i][1];
				} else
					sweets = x - sugar[i][1];
			}
		}
		System.out.println(f == 0 ? "-1" : sweets);
	}

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int f = 0, sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
				sc.nextInt();
			} else {
				f++;
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
				if (sugar[i][0] == s && sugar[i][1] > 0) {
					f--;
					sugar[i][0] = 0;
					sugar[i][1] = 101;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0) {
				if (i != 0) {
					if (x - sugar[i][1] > sweets)
						sweets = x - sugar[i][1];
				} else
					sweets = x - sugar[i][1];
			}
		}
		System.out.println(f <= 0 && sweets == 0 ? "-1" : sweets);
	}

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int f = 0, sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
				sc.nextInt();
			} else {
				f = 1;
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0) {
				if (i != 0) {
					if (x - sugar[i][1] > sweets)
						sweets = x - sugar[i][1];
				} else
					sweets = x - sugar[i][1];
			}
		}
		System.out.println(f == 0 ? "-1" : sweets);
	}

}


import java.util.Scanner;

public class A463C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int f=0,sweets = 0;
		int[][] sugar = new int[n][2];
		for (int i = 0; i < n; i++) {
			int t = sc.nextInt();
			if (t > s) {
				sugar[i][0] = 0;
				sugar[i][1] = 101;
			} else {
				f=1;
				sugar[i][0] = t;
				sugar[i][1] = sc.nextInt();
			}
		}
		for (int i = 0; i < n; i++) {
			int x = 100;
			if (sugar[i][1] < x && sugar[i][1] != 0)
				sweets = x - sugar[i][1];
		}
		System.out.println(f==0 ? "-1" : sweets);
	}

}