#include <iostream>
using namespace std;

int main () {
  int S;
  cin >> S;
  for( int s=1; s<=S; s++ ){
    cout << "Scenario #" << s << ":\n";
    
    //--- Read.
    int n, c[2], w[10];
    cin >> n >> c[0] >> c[1];
    for( int i=0; i<n; i++ )
      cin >> w[i];
    
    // best[d][m] = (trips * 999 + load) :
    // The best way for driver d to move all items in bitmask m,
    // telling the minimum number of trips needed and the minimum
    // load needed in the last of those trips.
    
    //--- Precompute drivers separately.
    int M = 1 << n;
    int best[2][M];
    for( int d=0; d<2; d++ ){
      best[d][0] = 998;
      for( int m=1; m<M; m++ ){
	best[d][m] = 99999;
	
	//--- Try each item in m as the last one. 
	for( int i=0; i<n; i++ ){
	  if( m&(1<<i) && w[i]<=c[d] ){
	    int x = best[d][m^(1<<i)];
	    if( x%999 + w[i] > c[d] )
	      x = (x/999 + 1) * 999;
	    best[d][m] = min(best[d][m], x + w[i]);
	  }
	}
      }
    }
    
    //--- Combine and answer.
    int answer = 99;
    for( int m=0; m<M; m++ )
      answer = min(max(best[0][m]/999, best[1][M-1-m]/999), answer);
    cout << answer << "\n\n";
  }
}
