#include <iostream>
#include <algorithm>
using namespace std;

int b[1000];
int g[1000];

void foo ( int e ) {
  if( e ){
    foo( b[e] );
    g[e] = 3 - g[b[e]];
  }
}

int main () {
  int S;
  cin >> S;
  for( int s=1; s<=S; s++ ){
    cout << "Scenario #" << s << ":" << endl;
    
    //--- Listen.
    int u, v, n;
    cin >> u >> v >> n;
    for( int i=1; i<n; i++ )
      cin >> b[i];
    
    //--- Dance.
    g[0] = 1;
    for( int i=1; i<n; i++ )
      foo( i );
    int x = count( g, g+n, 1 );
    
    //--- Answer.
    cout << min(u*x+v*(n-x), v*x+u*(n-x)) << endl << endl;
  }
}
