#include using namespace std; template void chmin(T&x,const T &y) { if(x>y)x=y; } template void chmax(T &x,const T &y) { if(x pii; #define rep(i,l,r) for(int i=l;i<=r;++i) #define per(i,r,l) for(int i=r;i>=l;--i) #define rep0(i,l,r) for(int i=l;i='0')x=x*10+c-'0'; return -x; } int x=c-'0'; while(gc>='0')x=x*10+c-'0'; return x; } #undef gc const int inf=1e9+5; namespace FLOW { #define Komachi is retarded #define REP(i,a,b) for(int i=(a),i##_end_=(b);ii##_end_;i--) const int M = 404; const int INF = 0x3f3f3f3f; inline void chkmax(int &a,const int &b){if(ab)a=b;} int nl,nr,n,m,D[M][M]; int A[M]; int To[M]; s64 L[M],Slack[M]; bool Vis[M]; int Q[M],Pre[M]; void Updata(){ int d=INF; REP(i,1,n+1)if(!Vis[i])chkmin(d,Slack[i]); REP(i,1,n+1)if(Vis[i])L[i]+=d; else Slack[i]-=d; REP(i,n+1,n+n+1)if(Vis[i])L[i]-=d; } int BFS(int x){ int l,r; l=r=0; Vis[Q[r++]=x]=1; while(1){ while(lSlack[B])continue; Pre[B]=A; if(!d){ Vis[B]=1; if(!To[B])return B; else Vis[Q[r++]=To[B]]=1; } else Slack[B]=d; } } Updata(); REP(B,1,n+1)if(!Vis[B] && !Slack[B]){ Vis[B]=1; if(!To[B])return B; else Vis[Q[r++]=To[B]]=1; } } return -1; } s64 Solve(){ REP(i,1,n+1)L[i]=A[i]; REP(i,n+1,n+n+1){ REP(j,0,n+4)Slack[j]=1e18; memset(Vis,0,sizeof(Vis)); int x=BFS(i); while(x)swap(x,To[To[x]=Pre[x]]); } long long ans=0; REP(i,1,nl+1)ans+=D[i][To[i]]; return ans; } void init(int _n) { // cerr<>tt; rep(case_id,1,tt) { int n=read(); FLOW::init(n); printf("Case #%d: %I64d\n",case_id,-FLOW::Solve()+(s64)inf*n); } }