stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll mem[45][45][45];

int G[45][45];

ll dp(int s, int t, int u){

    if (s == u) return 1;

    else if (s == t || t == u) return 0;

    if (mem[s][t][u] != -1) return mem[s][t][u];

    //printf("%d %d %d\n",s,t,u);

    ll ans = 0;

    for (int p1 = s; p1 < t; p1++){

        for (int p2 = t+1; p2 <= u; p2++){

            //printf("can take %d-%d\n",p1,p2);

            for (int r1 = s; r1 <= p1; r1++){

                for (int r2 = p2; r2 <= u; r2++){

                    if (G[r1][r2] == 0) continue;

                    //printf("+%lld*%lld*%lld\n",dp(s,r1,p1),dp(p1+1,t,p2-1),dp(p2,r2,u));

                    ll num = dp(s,r1,p1)*dp(p1+1,t,p2-1)*dp(p2,r2,u);

                    //printf("if take %d-%d: add %lld\n",r1,r2,num);

                    ans += num;

                }

            }

        }

    }

    //printf("%d %d %d: %lld\n",s,t,u,ans);

    return mem[s][t][u] = ans;

}

int main(){

	int n;

	scanf("%d",&n);

	for (int i = 0; i < 2*n; i++){

        for (int j = 0; j < 2*n; j++){

            char x;

            scanf(" %c",&x);

            G[i][j] = x-'0';

        }

	}

	memset(mem,-1,sizeof(mem));

	ll ans = 0;

	for (int i = 1; i <= 2*n-1; i++){

        if (G[0][i]){

            ans += dp(1,i,2*n-1);

            //printf("if take 0-%d, %lld\n",i,dp(1,i,2*n-1));

        }

	}

	printf("%lld",ans);

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll dp[41][41][41];

int G[41][41];

int main(){

	int n;

	scanf("%d",&n);

	n *= 2;

	for (int i = 0; i < n; i++){

        for (int j = 0; j < n; j++){

            char x;

            scanf(" %c",&x);

            G[i][j] = x-'0';

        }

	}

	for (int i = 1; i < n; i++) dp[i][i][i] = 1;

	for (int l = 1; l < n; l++){

        for (int s = 1; s+l < n; s++){

            int u = s+l;

            for (int t = s+1; t < u; t++){

                for (int p1 = s; p1 < t; p1++){

                    for (int p2 = t+1; p2 <= u; p2++){

                        for (int r1 = s; r1 <= p1; r1++){

                            for (int r2 = p2; r2 <= u; r2++){

                                if (G[r1][r2] == 0) continue;

                                dp[s][t][u] += dp[s][r1][p1]*dp[p1+1][t][p2-1]*dp[p2][r2][u];

                            }

                        }

                    }

                }

            }

        }

	}

	ll ans = 0;

	for (int i = 1; i <= n-1; i++){

        if (G[0][i]){

            ans += dp[1][i][n-1];

            //printf("if take 0-%d, %lld\n",i,dp(1,i,2*n-1));

        }

	}

	printf("%lld",ans);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)

#define ll long long

using namespace std;

const int N=50;

int n;

char a[N][N];

ll f[N][N][N],ans;

ll calc(int l,int i,int r){

	if(l==r)return 1;

	if(l==i||i==r)return 0;

	if(f[l][i][r]!=-1)return f[l][i][r];

	ll tot=0;

	fo(j,l,i-1)

		fo(p,j,i-1)

			fo(q,i+1,r)

				fo(k,q,r)

					if(a[j][k]=='1')

						tot+=calc(l,j,p)*calc(q,k,r)*calc(p+1,i,q-1);

	return f[l][i][r]=tot;

}

int main(){

	scanf("%d",&n);n*=2;

	fo(i,1,n)scanf("\n%s",a[i]+1);

	memset(f,255,sizeof f);

	fo(i,2,n)if(a[1][i]=='1')ans+=calc(2,i,n);

	cout<<ans;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)

#define ll long long

using namespace std;

const int N=50;

int n;

char a[N][N];

ll f[N][N][N],s[N][N],ss,ans;

int main(){

	scanf("%d",&n);n*=2;

	fo(i,1,n)scanf("\n%s",a[i]+1),f[i][i][i]=1;

	for(int len=2;len<=n-2;len+=2)

		fo(l,2,n-len){

			int r=l+len;

			fo(j,l,r)fo(k,j,r)s[j][k]=0;

			fo(j,l,r){

				fo(q,j+1,r){

					ss=0;

					fo(k,q,r)if(a[j][k]=='1')ss+=f[q][r][k];

					fo(p,j,q)s[p][q]+=ss*f[l][p][j];

				}

			}

			fo(p,l,r)fo(q,p,r)

				fo(i,p+1,q-1)f[l][r][i]+=s[p][q]*f[p+1][q-1][i];

		}

	fo(i,2,n)if(a[1][i]=='1')ans+=f[2][n][i];

	cout<<ans;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cassert>

#include <cstring>

#include <algorithm>

#define meow(args...) fprintf(stderr, args)

template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}

template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}

template<class Type> Type read() {

	Type a;

	bool b;

	unsigned char c;

	while(c=getchar()-'0', (c>9)&(c!=253));

	for(a=(b=c==253)?0:c; (c=getchar()-'0')<=9; a=a*10+c);

	return b?-a:a;

}

int (*rd)()=read<int>;

int n;

char a[40][41];

long long f[40][40][40];

int main() {

	assert(scanf("%d", &n)==1);

	for(int i=0; i<2*n; ++i) assert(scanf("%s", a[i])==1);

	for(int i=1; i<2*n; ++i) f[i][i][i]=1;

	for(int len=3; len<2*n; len+=2)

		for(int i=1, k=len; k<2*n; ++i, ++k)

			for(int j=i+1; j<k; ++j)

				for(int p=i; p<j; ++p)

					for(int r=j; r<k; ++r) {

						long long s=0;

						for(int l=p+1; l<=j; ++l) s+=f[i][p][l-1]*f[l][j][r];

						for(int q=r; q<=k; ++q) if(a[p][q]=='1') f[i][j][k]+=s*f[r+1][q][k];

					}

	long long ans=0;

	for(int i=1; i<2*n; ++i) if(a[0][i]=='1') ans+=f[1][i][2*n-1];

	printf("%lld\n", ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cassert>

#include <cstring>

#include <algorithm>

#define meow(args...) fprintf(stderr, args)

template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}

template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}

template<class Type> Type read() {

	Type a;

	bool b;

	unsigned char c;

	while(c=getchar()-'0', (c>9)&(c!=253));

	for(a=(b=c==253)?0:c; (c=getchar()-'0')<=9; a=a*10+c);

	return b?-a:a;

}

int (*rd)()=read<int>;

int n;

char a[40][41];

long long f[40][40][40], g[40][40][40];

int main() {

	assert(scanf("%d", &n)==1);

	for(int i=0; i<2*n; ++i) assert(scanf("%s", a[i])==1);

	for(int i=2*n; --i; ) {

		f[i][i][i]=1;

		for(int j=1; j<2*n; ++j) if(a[i][j]=='1') g[i][i][j]=1;

		for(int j=i+2; j<2*n; j+=2) {

			for(int l=i; l<=j; ++l)

				for(int r=l+2; r<=j; ++r) {

					long long s=0;

					for(int q=r; q<=j; ++q) s+=g[i][l][q]*f[r][j][q];

					for(int k=l; k<=r; ++k) f[i][j][k]+=f[l+1][r-1][k]*s;

				}

			for(int k=i+1; k<j; ++k) {

				for(int q=0; q<i; ++q) if(a[k][q]=='1') g[i][j][q]+=f[i][j][k];

				for(int q=2*n; q-->j; ) if(a[k][q]=='1') g[i][j][q]+=f[i][j][k];

			}

		}

	}

	long long ans=0;

	for(int i=1; i<2*n; ++i) if(a[0][i]=='1') ans+=f[1][2*n-1][i];

	printf("%lld\n", ans);

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i, n) for (int i=0; i<(int)(n); i++)

#define all(v) v.begin(), v.end()

using namespace std;

using ll = long long;

using Graph = vector<vector<int>>;

const ll MOD = 1000000007;

const ll INF = 9999999999;

template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}

template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}

template<class T> inline T powerM(T a,T b){if (b==0) return 1;

  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }





vector<vector<ll>> dp(11, vector<ll>(1001, -1));

// dp[i][j]...i問目までをj問解いて得られる最大の点数



int main() {

  int d; cin >>d;

  ll g; cin >>g;

  vector<ll> p(d), c(d);

  rep(i, d) cin >>p.at(i) >>c.at(i);



  dp.at(0).at(0) = 0;



  for (int i=0; i<d; i++){

    for (int j=0; j<=1000; j++){

      if (dp.at(i).at(j) == -1) continue;

      for (int k=0; k<=p.at(i); k++){

        if (k == p.at(i)) chmax(dp.at(i+1).at(j+k), dp.at(i).at(j) + k * 100 * (i+1) + c.at(i));

        else chmax(dp.at(i+1).at(j+k), dp.at(i).at(j) + k * 100 * (i+1));

      }

    }

  }



  int res = MOD;

  for (int i=0; i<=d; i++){

    for (int j=0; j<=1000; j++){

      if (dp.at(i).at(j) >= g) chmin(res, j);

    }

  }

  cout <<res <<endl;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i, n) for (int i=0; i<(int)(n); i++)

#define all(v) v.begin(), v.end()

using namespace std;

using ll = long long;

using Graph = vector<vector<int>>;

const ll MOD = 1000000007;

const ll INF = 9999999999;

template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}

template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}

template<class T> inline T powerM(T a,T b){if (b==0) return 1;

  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }





int D; ll G;

vector<int> p;

vector<ll> c;



int main() {

  // 入力

  cin >>D >>G;

  p.assign(D, 0);

  c.assign(D, 0);

  rep(i, D) cin >>p.at(i) >>c.at(i);

  int res = 10 * 100+1;



  // 完全に解き切る100i点の問題を全探索

  for (int bit=0; bit<(1<<D); bit++){

    ll score = 0;

    int pros = 0;

    bool ok = true;

    for (int i=0; i<D; i++){

      if (bit & (1<<i)) score += 100 * (i+1) * p.at(i) + c.at(i), pros += p.at(i);

    }

    if (score < G){

      for (int i=D-1; i>=0; i--){

        if (bit & (1<<i)) continue;

        int onepro = 100 * (i+1);

        int buf = (G - score + onepro - 1) / onepro;

        if (buf > p.at(i)) ok = false;

        pros += buf;

        break;

      }

    }

    if (ok) res = min(res, pros);

  }



  cout <<res <<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include<algorithm>

#include<string>

#include<map>

#include<math.h>

#include<queue>

#include<deque>

#include<stack>

#include<cstdio>

#include<utility>

#include<set>

#include<list>

#include<cmath>

using namespace std;

using ll = long long;

using pii = pair<int, int>;

const int INF = 1e9;

ll D;

ll G;

ll dp[12][1201] = {};//iの問題まで解いた時の最大点数

int main() {

	cin >> D >> G;

	int p[11], c[11];

	for (int i = 1; i <= D; ++i) {

		cin >> p[i] >> c[i];

	}

	for (int i = 1; i <= D; ++i) {

		for (int j = 0; j < 1010; ++j) {

			for (int k = 0; k <= p[i]; ++k) {

				if (k == p[i]) {

					dp[i][j+k] = max(dp[i][j+k], dp[i-1][j] + 100 *i*k + c[i]);

				}

				else {

					dp[i][j + k] = max(dp[i][j + k], dp[i - 1][j] + 100 * i*k);

				}

			}

		}

	}

	for (int i = 0; i < 1010; ++i) {

		if (dp[D][i] >= G) {

			cout << i << endl;

			break;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<vector>

#include<algorithm>

#include<string>

#include<map>

#include<math.h>

#include<queue>

#include<deque>

#include<stack>

#include<cstdio>

#include<utility>

#include<set>

#include<list>

#include<cmath>

#include<stdio.h>

#include<string.h>

#include<cstdio>

#include<iomanip>

using namespace std;

using ll = long long;

using pii = pair<int, int>;

using piii = pair<pii, pii>;

const int INF = 1e9 + 7;

int D;

ll G;

vector<ll>p, c;

int main() {

	cin >> D >> G;

	p.resize(D); c.resize(D);

	for (int i = 0; i < D; ++i) {

		cin >> p[i] >> c[i];

	}

	ll res = 1 << 29;//全完する難易度帯を2^D通り固め打ちする

	for (int bit = 0; bit < (1 << D); ++bit) {

		ll sum = 0;

		ll num = 0;

		for (int i = 0; i < D; ++i) {

			if (bit & (1 << i)) {

				sum += c[i] + p[i] * 100 * (i + 1), num += p[i];

			}

		}

		if (sum >= G)res = min(res, num);

		else {

			for (int i = D - 1; i >= 0; --i) {

				if (bit&(1 << i))continue;

				for (int j = 0; j < p[i]; ++j) {

					if (sum >= G)break;

					sum += 100 * (i + 1);

					++num;

				}

			}

			res = min(res, num);

		}

	}

	cout << res << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<algorithm>

#include<iostream>

#include<queue>

#include<vector>

using namespace std;

#define MAX 1000000

typedef long long ll;





int main(){

  int D,G;

  cin>>D>>G;

  int p[200];

  ll c[200];

  for(int i=0;i<D;i++){

    cin>>p[i]>>c[i];

  }

  ll dp[20][2000]={0};

  for(int i=0;i<D;i++){

    for(int j=0;j<=i*100;j++){

      for(int k=0;k<=p[i];k++){

        ll score=(i+1)*100*k;

        if(k==p[i]) score+=c[i];

        dp[i+1][j+k]=max(dp[i+1][j+k],dp[i][j]+score);

      }

    }

  }

  int ans;

  for(int i=0;i<2000;i++){

    if(dp[D][i]>=G){

      ans=i;

      break;

    } 

  }

  cout<<ans<<endl;





}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstdlib>

#include<algorithm>

#include<iostream>

#include<queue>

#include<vector>

#include <bitset>

#include<math.h>

using namespace std;

#define INF 110000000000

#define MOD 1000000007

typedef long long ll;

typedef pair<ll,int> P;



int D,G,p[11],c[11];



int main(){

  cin>>D>>G;



  for(int i=0;i<D;i++){

    cin>>p[i]>>c[i];

  }



  int ans=1e9;



  for(int bit=0;bit< (1<<D); bit++){

    int s=0,num=0,rest_max=-1;

    for(int i=0;i<D;i++){

      if(bit>>i & 1){

        s+=100*(i+1)*p[i]+c[i];

        num+=p[i];

      }else{

        rest_max=i;

      }

    }

    if(s<G){

      int s1=100*(rest_max+1);

      int need=(G-s+s1-1)/s1;

      if(need>=p[rest_max]) continue;

      else{

        num+=need;

        //cout<<num<<" "<<s<<endl;

        

      }

    }

    ans=min(ans,num);

  }

  cout<<ans<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <iomanip>

#include <vector>



#define REP(i, n) for (int i = 0; i < (n); i++)



using namespace std;



// dp[i][j] :=

// i個目までみていて,j問解いた時のスコアの最大値

int dp[20][1200];



int main()

{

  int D, G;

  cin >> D >> G;

  vector<int> p(D);

  vector<int> c(D);

  REP(i, D) {

    cin >> p[i] >> c[i];

  }



  REP(i,20)REP(j,1200)dp[i][j] = -1;

  REP(j, 1200)dp[0][j] = 0;



  REP(i, D) {

    REP(j, 1001) {

      if (dp[i][j] == -1) continue;

      for (int k = 0; k < p[i]; k++) {

        dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] + 100*(i + 1)*k);

      }

      dp[i + 1][j + p[i]] = max(dp[i + 1][j + p[i]], dp[i][j] + 100*(i + 1)*p[i] + c[i]);

    }

  }



  int ans;

  REP(i, 1001) {

    if (dp[D][i] >= G) {

      ans = i;

      break;

    }

  }

  cout << ans << endl;



  return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#define REP(i, n) for(int i = 0; i < n; i++)



using namespace std;



int D, G;

int p[15], c[15];



void showBit(int num)

{

  REP(i, D) {

    if ((num >> i) & 1) cout << '1';

    else cout << '0';

  }

}



int dfs(int d, int used)

{

  if (d == D) {

    int score = 0;

    int ret = 0;

    REP(i, D) {

      if ((used >> i) & 1) {

        score += 100*(i+1)*p[i] + c[i];

        ret += p[i];

      }

    }

    if (score >= G) return ret;



    int k = D - 1;

    while ((used >> k) & 1) k--;

    REP(i, p[k]) {

      score += 100*(k+1);

      ret++;

      if (score >= G) return ret;

    }

    return 1100000000;

  }

  return min(dfs(d + 1, used | (1 << d)), dfs(d + 1, used));

}



int main()

{

  cin >> D >> G;

  REP(i, D) cin >> p[i] >> c[i];



  cout << dfs(0, 0) << endl;



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> P;

typedef long long ll;

typedef long double ld;

const int inf=1e9+7;

const ll longinf=1LL<<60;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )

#define rep(i,n) REP(i,0,n)

#define F first

#define S second



const int mx=100010;

const ll mod=1e9+7;



int main(){

  int d,g;

  cin >> d >> g;

  vector<ll> p(d),c(d);

  rep(i,d){ cin >> p[i] >> c[i]; }

  vector<ll> dp(mx,0);

  

  rep(i,d)for(int k=1000; k>=1; k--)for(int j=1; j<=p[i]&&j<=k; j++){

    dp[k]=max(dp[k], dp[k-j]+(i+1)*100*j+(j==p[i]?c[i]:0));

  }

  rep(i,1001)if(dp[i]>=g){ cout<<i<<endl; return 0;}

  

  return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> P;

typedef long long ll;

typedef long double ld;

const int inf=1e9+7;

const ll longinf=1LL<<60;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )

#define rep(i,n) REP(i,0,n)

#define F first

#define S second

 

const int mx=100010;

const ll mod=1e9+7;





int main(){

  int d,g;

  cin >> d >> g;

  vector<ll> p(d), c(d);

  rep(i,d){

    cin >> p[i] >> c[i];

  }

  vector<ll> dp(1010,0);

  rep(i,d)for(int j=1000; j>=1; j--) for(int k=1; k<=p[i]&&k<=j; k++){

    dp[j] = max(dp[j], dp[j-k] + (i+1)*100*k + (k==p[i]?c[i]:0));

  }

  rep(i,1001)if(dp[i]>=g){

    cout << i << endl; break;

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<map>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;



typedef pair<int,int> P;

typedef pair<int,P> P2;



int n,m,l,k;

int u,v,c;

int s,g,t;

int b[7];



int dis[51][1<<7][10],vis[51][1<<7];

vector<P> G[51];

const int INF = 100000000;



int main(){

  while(cin >> n >> m >> l >> k,n+m+l+k){

    for(int i=1;i<=n;i++)G[i].clear();

    for(int i=0;i<m;i++){

      cin >> u >> v >> c;

      G[u].push_back(P(c,v));

      G[v].push_back(P(c,u));

    }

    cin >> s >> g;

    for(int i=0;i<l;i++)cin >> b[i];



    for(int i=1;i<=n;i++)

      for(int j=0;j<(1<<l);j++){

	for(int x=0;x<k;x++)dis[i][j][x] = INF;

	vis[i][j] = 0;

      }



    int st = 0;

    for(int i=0;i<l;i++)if(s==b[i])st |= 1<<i;



    priority_queue< P2,vector<P2>,greater<P2> > q;

    q.push(P2(0,P(s,st)));

    

    while(q.size()){

      P2 p = q.top(); q.pop();

      int dist = p.first, pos = p.second.first, state = p.second.second;



      if(vis[pos][state] < k){

	dis[pos][state][vis[pos][state]] = dist;

	vis[pos][state]++;

      }else continue;



      for(int i=0;i<G[pos].size();i++){

	int cost = G[pos][i].first, nxt = G[pos][i].second;

	int nstate = state;

	for(int j=0;j<l;j++)if(nxt==b[j])nstate |= 1<<j;



	if(vis[nxt][nstate] < k)q.push(P2(dist+cost,P(nxt,nstate)));

      }

    }

    int res = dis[g][(1<<l)-1][k-1];

    if(res==INF)cout << "NA\n";

    else cout << res << endl;

  }

}

      

// Optimized solution to the same problem (faster):
#include<iostream>

#include<map>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;



typedef pair<int,int> P;

typedef pair<int,P> P2;



int n,m,l,k;

int u,v,c;

int s,g,t;

int b[7];



int dis[51][1<<7][10],vis[51][1<<7];

vector<P> G[51];

const int INF = 100000000;



int main(){

  while(cin >> n >> m >> l >> k,n+m+l+k){

    for(int i=1;i<=n;i++)G[i].clear();

    for(int i=0;i<m;i++){

      cin >> u >> v >> c;

      G[u].push_back(P(c,v));

      G[v].push_back(P(c,u));

    }

    cin >> s >> g;

    for(int i=0;i<l;i++)cin >> b[i];



    for(int i=1;i<=n;i++)

      for(int j=0;j<(1<<l);j++){

	for(int x=0;x<k;x++)dis[i][j][x] = INF;

	vis[i][j] = 0;

      }



    int st = 0;

    for(int i=0;i<l;i++)if(s==b[i])st |= 1<<i;



    priority_queue< P2,vector<P2>,greater<P2> > q;

    q.push(P2(0,P(s,st)));

    

    while(q.size()){

      P2 p = q.top(); q.pop();

      int dist = p.first, pos = p.second.first, state = p.second.second;



      if(vis[pos][state] < k){

	dis[pos][state][vis[pos][state]] = dist;

	vis[pos][state]++;

	if(pos==g && state==(1<<l)-1 && vis[pos][state]==k)break;

      }else continue;



      for(int i=0;i<G[pos].size();i++){

	int cost = G[pos][i].first, nxt = G[pos][i].second;

	int nstate = state;

	for(int j=0;j<l;j++)if(nxt==b[j])nstate |= 1<<j;



	if(vis[nxt][nstate] < k)q.push(P2(dist+cost,P(nxt,nstate)));

      }

    }

    int res = dis[g][(1<<l)-1][k-1];

    if(res==INF)cout << "NA\n";

    else cout << res << endl;

  }

}

      

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<set>

#include<cstdio>

#include<queue>

#include<cmath>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

long long read(){

	long long f=1,x=0;

	char c=getchar();

	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}

	while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}

	return f*x;

}

int main(){

	long long  a=read(),b=read();

	if((a*b)%2==0)

		printf("Even\n");

	else

		printf("Odd\n");

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	#ifdef LOACL

	freopen("in.txt","r",stdin);

	freopen("out.txt","w",stdout);

	#endif

	int a,b;

	scanf("%d %d",&a,&b);

	if((a*b)%2==0)printf("Even\n");

	else printf("Odd\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<cstdio>

#include<algorithm>

using namespace std;

int a,b;

int main()

{

	cin>>a>>b;

	if(a*b&1)cout<<"Odd";

	else

	cout<<"Even";

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main(void)

{

	int a,b;

	scanf("%d %d",&a,&b);

	printf("%s\n",(a*b)&1?"Odd":"Even");

	return 0;

}

/*

#include<stdio.h>

using namespace std;

int main(void)

{

	int left=1,right=100000000,mid,a,b;

	scanf("%d %d",&a,&b);

	while(left<=right)

	{

		mid=(left+right)/2;

		if(mid==a*b)

			break;

		else if(mid>a*b)

			right=mid;

		else

			left=mid;

	}

	printf("%s\n",mid&1?"Odd":"Even");

	return 0;

}

*/

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#include<iostream>

//#include<cstdio>

//#include<string>

//#include<string>

//#include<algorithm>

//#include<ctime> printf("\n%lldms",clock());

//#include<cmath>

//#include<vector>

//#include<queue>

#include <bits/stdc++.h>

#define lijyya 300010

#define oo 0x3f3f3f3f

#define emmm 100003

#define f1(i,a,b) for (register int i=a;i<=b;++i)

#define f2(i,a,b) for (register int i=a;i<b;++i)

#define f3(i,a,b) for (register int i=a;i>=b;--i)

#define f4(i,a,b) for (register int i=a;i>b;--i)

using namespace std;

typedef long long ll;

template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}

template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}

inline int read(){

    int f=1,x=0;char ch;

    do{

        ch=getchar();if(ch=='-') f=-1;

    }while(ch<'0'||ch>'9');

    do{

        x=x*10+ch-'0';ch=getchar();

    }while(ch>='0'&&ch<='9');

    return f*x;

}



int n,a;

int main(){

    n=read();

    a=read();

    if(n*a%2==0) printf("Even");

    else printf("Odd");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main(void)

{

	int a,b;

	scanf("%d %d",&a,&b);

	printf("%s\n",(a*b)&1?"Odd":"Even");

	return 0;

}

/*

#include<stdio.h>

using namespace std;

int main(void)

{

	int left=1,right=100000000,mid,a,b;

	scanf("%d %d",&a,&b);

	while(left<=right)

	{

		mid=(left+right)/2;

		if(mid==a*b)

			break;

		else if(mid>a*b)

			right=mid;

		else

			left=mid;

	}

	printf("%s\n",mid&1?"Odd":"Even");

	return 0;

}

*/

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	int a,b;

	cin>>a>>b;

	if((a*b)%2==0){

		cout<<"Even";

	}

	else{

		cout<<"Odd";

	}

	return 0;	

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    if((a*b)%2==0)printf("Even\n");

    else

        printf("Odd\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main(){

  int a, b;

  scanf("%d %d", &a, &b);

  if(a & 1 && b & 1) printf("Odd\n");

  else printf("Even\n");

  

  return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    if((a*b)%2==0)printf("Even\n");

    else

        printf("Odd\n");

}

// Fastest known solution for this problem: