//暴力模拟,就是题目优点绕,没打过游戏的可能要理解一会了
//时间片为1,给技能设定一个倒计时,available[]为0说明当前可以攻击

package org.niuke.solution75;

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        for(int i = 0; i < num; i++){
            int tower = scanner.nextInt();
            int n = scanner.nextInt(), //小兵数量
                    d = scanner.nextInt(), //小兵伤害
                    x = scanner.nextInt(),
                    y = scanner.nextInt(),
                    t0 = scanner.nextInt(),
                    t1 = scanner.nextInt(),
                    t2 = scanner.nextInt();

            int time = 0;
            int[] available = new int[3];
            while (time >= 0) {
                if(available[0] == 0){
                    tower -= n * d;
                    available[0] = t0 - 1;
                }else{
                    available[0]--;
                }
                if(tower <= 0){
                    System.out.println("NO");
                    break;
                }
                if(available[1] == 0){//人物平A
                    tower -= y;
                    available[1] = t1 - 1;
                }else{
                    available[1]--;
                }
                if(available[2] == 0){//人物技能
                    tower -= x;
                    available[2] = t2 - 1;
                }else{
                    available[2]--;
                }
                if(tower <= 0){
                    System.out.println("YES");
                    break;
                }
                time++;
            }
        }
    }
}