#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() 
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,a,b,x,y,z;
        
        
        cin>>n>>a>>b>>x>>y>>z;
        priority_queue<int>pq;
        for(int i=0;i<n;i++)
        {
        	int temp;
        	cin>>temp;
        	pq.push(temp);
        }
        int temp=((z-b)/y);
        
        if((float)((z-b)/(float)y)==(float)temp)
        temp--;
        
        a=a+temp*x;
        int count=0;
        while(a<z && !pq.empty() && pq.top()!=0){
            a+=pq.top();
            int temp2=pq.top();
            pq.pop();
            pq.push(temp2/2);
            count++;
        }
        if(a>=z)
        cout<<count;
        else
        cout<<"RIP";
        
        cout<<"\n";
    	
    }
        
    
}