#include <iostream>
#include <algorithm>
#define INF (1e9)
#define J 2000
#define N 50
using namespace std;
int main(){
  int n,c[N],dp[J],dn[J],C=0;
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++) cin>>c[i];
    for(int i=0;i<J;i++) dp[i]=dn[i]=INF;
    dp[0]=0;
    for(int i=0;i<n;i++)
      for(int j=1;j<J;j++)
	if(j>=c[i]) dp[j]=min(dp[j],dp[j-c[i]]+1);
    reverse(c,c+n);
    for(int i=0;i<J;i++){
      int cnt=0,sum=i;
      for(int j=0;j<n;j++){
	cnt+=sum/c[j];
	sum%=c[j];
      }
      if(sum==0) dn[i]=cnt;
    }
    int flag=0;
    for(int i=1;i<J;i++){
      if(dp[i]==INF||dn[i]==INF){
	flag=1;
	break;
      }
      if(dp[i]!=dn[i]){
	flag=2;
	break;
      }
    }
    C++;
    cout<<"Case #"<<C<<": ";
    if(!flag) cout<<"OK"<<endl;
    else if(flag==1) cout<<"Cannot pay some amount"<<endl;
    else cout<<"Cannot use greedy algorithm"<<endl;
  }
  return 0;
}