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

using namespace std;

#define int long long

int ll[200007],ff[200007];

const int mod = 1e9 + 7;



int qpow(int a,int b){

  int ret=1;

  while(b){

    if(b&1) ret=(ret*a)%mod;

    a=(a*a)%mod;

    b>>=1;

  }

  return ret;

}





int cc(int n,int m){

  return (ff[n]*ll[m])%mod*ll[n-m]%mod;

}



int count_ways(int a,int b,int c,int d){

  int tot=(c-a)+(d-b);

  int down=(c-a);

  int ret=cc(tot,down);

  return ret;

}

main()

{

	

	int n,m,a,b;

	cin>>n>>m>>a>>b;

	ff[0]=1; ll[0]=1;

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

	{

    ff[i]=i*ff[i-1]%mod;

    ll[i]=qpow(ff[i],mod-2);

    }

	int tot=count_ways(1,1,n,m);

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

	{

        int tmp=count_ways(1,1,n-a,i)*count_ways(n-a+1,i,n,m)%mod;

        tot=(tot-tmp+mod)%mod;

    }

    cout<<tot<<endl;

}

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



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

        fac[i]=fac[i-1]*i%MOD;

    //inv[fac[i]]=Pow(fac[i],MOD-2)=Pow(1,MOD-2)...Pow(i,MOD-2)

    //inv[fac[i-1]]=Pow(fac[i-1],MOD-2)=Pow(1,MOD-2)...Pow(i-1,MOD-2)=Pow(fac[i],MOD-2)/Pow(i,MOD-2)=inv[i]*i

    inv[0]=1;

    inv[N]=Pow(fac[N],MOD-2);

    for(int i=N-1;i>=1;i--)

        inv[i]=inv[i+1]*(i+1)%MOD;

}



LL C(int m,int n){

    return fac[m]*inv[n]%MOD*inv[m-n]%MOD;

}



int main(){

    int H,W,A,B;

    scanf("%d%d%d%d",&H,&W,&A,&B);

    Prep(H+W);

    LL Ans=0;

    for(int i=B+1;i<=W;i++){

        LL tmp1=C(H-A+i-2,i-1);

        //C(m+n-x-y-2,m-x-1)

        //(H-A,i) -> (H,W)

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

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

using namespace std;

typedef long long LL;

#define MAXN 200000

const int MOD = 1000000007;

int n, m, a, b, fac[MAXN+50]={1}, inv[MAXN+50]={1, 1};

inline int C(int n, int m)

{

    return (LL)fac[n] * inv[m] % MOD * inv[n-m] % MOD;

}

int main()

{

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

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

		fac[i] = (LL)fac[i-1] * i % MOD;

    for(int i=2; i<=n+m+5; i++)

		inv[i] = (LL)(MOD-MOD/i) * inv[MOD%i] % MOD;

	for(int i=2; i<=n+m+5; i++)

		inv[i] = (LL)inv[i-1] * inv[i] % MOD;

    int ans=0;

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

		ans += (LL)C(i+b-2,b-1) * C(n-i+m-b-1,n-i)%MOD,

		ans %= MOD;

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

    return 0;

}

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



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

        fac[i]=fac[i-1]*i%MOD;

    //inv[fac[i]]=Pow(fac[i],MOD-2)=Pow(1,MOD-2)...Pow(i,MOD-2)

    //inv[fac[i-1]]=Pow(fac[i-1],MOD-2)=Pow(1,MOD-2)...Pow(i-1,MOD-2)=Pow(fac[i],MOD-2)/Pow(i,MOD-2)=inv[i]*i

    inv[0]=1;

    inv[N]=Pow(fac[N],MOD-2);

    for(int i=N-1;i>=1;i--)

        inv[i]=inv[i+1]*(i+1)%MOD;

}



LL C(int m,int n){

    return fac[m]*inv[n]%MOD*inv[m-n]%MOD;

}



int main(){

    int H,W,A,B;

    scanf("%d%d%d%d",&H,&W,&A,&B);

    Prep(H+W);

    LL Ans=0;

    for(int i=B+1;i<=W;i++){

        LL tmp1=C(H-A+i-2,i-1);

        //C(m+n-x-y-2,m-x-1)

        //(H-A,i) -> (H,W)

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

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

#include<algorithm>

using namespace std;

typedef long long LL; 



const LL mod=(LL)1e9+7,N=(LL)1e5;



LL fac[2*N+5]={1};



LL exgcd(LL a,LL b,LL &x,LL &y)

{

	if(!b)

	{

		x=1; y=0;

		return a;

	}

	LL gcd=exgcd(b,a%b,x,y);

	LL tmp=x;

	x=y;

	y=tmp-(a/b)*y;

	return gcd;

}



LL C(LL n,LL m)

{

	LL x,y;

	exgcd( fac[m]*fac[n-m]%mod ,mod,x,y);

	return fac[n]*(x+mod)%mod;

}



int main()

{

	for(int i=1;i<=2*N;i++)

		fac[i]=(fac[i-1]*i)%mod;

	

	LL w,h,a,b;

	scanf("%lld %lld %lld %lld",&h,&w,&a,&b);

	

	LL ans=0;

	for(LL i=b+1;i<=w;i++)

		ans=(ans+(C(h-a+i-2,h-a-1)%mod)*(C(w-i+a-1,w-i)%mod))%mod;

	

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

	return 0;

}

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

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

using namespace std;

#include<vector>

#include<algorithm>

#include <iostream>

#include <math.h>

#define ll long long

using namespace std;

const ll mod = 1e9+7;

//快速幂

ll pow_quick(ll a,ll b){

    ll r = 1,base = a;

    while(b){

        if(b & 1){

            r *= base;

            r %= mod;

        }

        base *= base;

        base %= mod;

        b >>= 1;

    }

    return r;

}

//组合数

ll C(ll n, ll m){

    if(m > n)

        return 0;

    ll ans = 1;

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

        ll a = (n+i-m)%mod;

        ll b = i%mod;

        ans = (ans*(a*pow_quick(b,mod-2)%mod))%mod;

    }

    return ans;

}

//卢卡斯定理

ll Lucas(ll n, ll m){

    if(m == 0)

        return 1;

    return C(n%mod, m%mod)*Lucas(n/mod,m/mod)%mod;

}

ll sum0 = 0;



int main(){

    ll H,W,A,B;

    cin >> H>>W>>A>>B;

    //cout << 15*14*13*12*11*10/6/5/4/3/2/1;

    /*H--;

    W--;

    A--;

    B--;*/



    //10 7 3 4

    //Lucas(H-A+i-2,H-A-1)*Lucas(W-i+A-1,A-1

    //流泪 sum = Lucas(H+W,H);

    ll a = Lucas(H-A+(B+1)-2,H-A-1);

    ll b = Lucas(W-(B+1)+A-1,A-1);

    for(ll i = B+1; i <= W; i ++){

        sum0 += (a*b)%mod;

        sum0 %= mod;

        a *= (H-A+i-2+1);

        a %= mod;

        a *= pow_quick(H-A+i-2-(H-A-1)+1,mod-2);

        a %= mod;

        b *= W-i+A-1-(A-1);

        b %= mod;

        b *= pow_quick(W-i+A-1,mod-2);

        b %= mod;

        //pld(i) pn

        /*if(i % 10 == 0){

            pld(i) pn

        }*/

    }

    /*sum0 += (a*b)%mod;

    sum0 %= mod*/

    cout << (sum0+mod)%mod;





    return 0;

}


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

using namespace std;



int main()

{

  int N, dp[1 << 16];



  while(cin >> N, N) {

    memset(dp, 0, sizeof(dp));

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

      int M, L;

      cin >> M >> L;

      int bitMask = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        bitMask |= (1 << E) - (1 << S);

      }

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

        if(!(bitMask & j)) {

          dp[bitMask | j] = max(dp[bitMask | j], dp[j] + L);

        }

      }

    }

    cout << dp[(1 << 16) - 1] << endl;

  }

}

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

using namespace std;



int main()

{

  int N, K[100], L[100], dp[1 << 16];



  while(scanf("%d", &N), N) {

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

      int M;

      scanf("%d %d", &M, L + i);

      K[i] = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        K[i] |= (1 << E) - (1 << S);

      }

    }

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

    dp[0] = 0;

    int ret = 0;

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

      if(~dp[j]) {

        ret = max(ret, dp[j]);

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

          if(!(K[i] & j)) {

            dp[K[i] | j] = max(dp[K[i] | j], dp[j] + L[i]);

          }

        }

      }

    }

    printf("%d\n", ret);

  }

}

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

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

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

//#define int long long

typedef long long ll;

using namespace std;

const int MOD = 1000000007;

const int INF = 1010000000;

const double EPS = 1e-10;

const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 



signed main(){

  int n;cin>>n;int a[100000], b[100000];pair<int,int> c[100000];

  rep(i,n){

    cin>>a[i]>>b[i];

    c[i] = make_pair(a[i]+b[i], i);

  }

  sort(c,c+n,greater<pair<int,int>>());

  ll ans = 0;

  rep(i,n){

    if(!(i%2)){

      ans += a[c[i].second];

    }else{

      ans -= b[c[i].second];

    }

  }

  cout << ans << endl;

}


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

using namespace std;

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

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

typedef long long ll;

typedef long double lb;

#define int long long

#define double long double

#define endn "\n"

typedef pair<int,int> P;

const int MOD = 1000000007;

const ll INF = 1e16;

const double EPS = 1e-10;

const double PI = 3.141592653589793;

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

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

const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 





////////////////////////////////////////////////////////////////////



int n;P p[210000], q[210000];

signed main(){

  cin>>n;rep(i,n)cin>>p[i].first>>p[i].second;

  sort(p,p+n);

  rep(i,n){

    q[i].first = p[i].first + p[i].second;

    q[i].second = i;

  }

  sort(q,q+n, greater<P>());

  int ans = 0;

  rep(i,n){

    int t = q[i].second;

    if(i%2 == 0){

      ans += p[t].first;

    }else{

      ans -= p[t].second;

    }

  }

  cout << ans << endl;

}


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

#include <algorithm>

using namespace std;



int N;



typedef long long ll;



ll T = 0,AO = 0,ans=0;



struct Data {

  ll  A[100000];

  ll  B[100000];

  ll  C[100000];

};



int main() {

  cin >> N;

  Data data;

  for ( int i = 0; i < 100000; i++ ) data.C[i] = 0;

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

    cin >> data.A[i] >> data.B[i];

    data.C[i] = data.A[i] + data.B[i];

  }



  sort(data.C,data.C+N);



  for ( int i = 0; i < N; i++ ) ans -= data.B[i];

  

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

    ans += data.C[i];

  }



  cout << ans << endl;

  

  return 0;

}


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

#include <algorithm>

#include <vector>

using namespace std;



int N;



typedef long long ll;



ll T = 0,AO = 0,ans = 0;



struct Data {

  ll  A,B,C;

};



int main() {

  cin >> N;

  vector<Data> data(N);

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

    cin >> data[i].A >> data[i].B;

    data[i].C = data[i].A + data[i].B;

  }



   sort(data.begin(),data.end(),[](const Data &l, const Data&r){

  				 return (l.C > r.C); });

 

  

 bool f = true;

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

    if (f)  {

      T += data[i].A;

       f = false;

    }

    else {

      AO += data[i].B;

       f = true;

    }

  }

  ans = T - AO;

    cout << ans << endl;

  

  return 0;

}


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

#include <algorithm>

using namespace std;



int N;



typedef long long ll;



ll T = 0,AO = 0,ans=0;



struct Data {

  ll  A[100000];

  ll  B[100000];

  ll  C[100000];

};



int main() {

  cin >> N;

  Data data;

  for ( int i = 0; i < 100000; i++ ) data.C[i] = 0;

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

    cin >> data.A[i] >> data.B[i];

    data.C[i] = data.A[i] + data.B[i];

  }



  sort(data.C,data.C+N);



  for ( int i = 0; i < N; i++ ) ans += data.A[i];

  

  for ( int i = N-2; i >= 0; i-=2 ) {

    ans -= data.C[i];

  }



  cout << ans << endl;

  

  return 0;

}


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

#include <algorithm>

#include <vector>

using namespace std;



int N;



typedef long long ll;



ll T = 0,AO = 0,ans = 0;



struct Data {

  ll  A,B,C;

};



int main() {

  cin >> N;

  vector<Data> data(N);

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

    cin >> data[i].A >> data[i].B;

    data[i].C = data[i].A + data[i].B;

  }



   sort(data.begin(),data.end(),[](const Data &l, const Data&r){

  				 return (l.C > r.C); });

 

  

 bool f = true;

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

    if (f)  {

      T += data[i].A;

       f = false;

    }

    else {

      AO += data[i].B;

       f = true;

    }

  }

  ans = T - AO;

    cout << ans << endl;

  

  return 0;

}


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

using namespace std;



const int N = 36666, MOD = 1e9 + 7;

bool isnp[N];

vector<int> pri;

int val[N];

int fpow(int a, int b) {

  int ans = 1;

  for(; b > 0; b >>= 1, a = 1ll * a * a % MOD) {

    if(b & 1) {

      ans = 1ll * ans * a % MOD;

    }

  }

  return ans;

}



int main() {

  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

  isnp[0] = isnp[1] = true;

  for(int i = 2; i < N; i++) {

    if(!isnp[i]) {

      pri.push_back(i);

      for(int j = i + i; j < N; j += i) {

        isnp[j] = true;

      }

    }

  }

  int n; cin >> n;

  vector<int> v(n), oth;

  for(auto &x: v) {

    cin >> x;

    int t = x;

    for(int i = 0; i < int(pri.size()) && pri[i] <= t; i++) {

      if(t % pri[i] == 0) {

        int cnt = 0;

        while(t % pri[i] == 0) {

          t /= pri[i];

          cnt++;

        }

        val[i] = max(val[i], cnt);

      }

    }

    if(t > 1) {

      oth.push_back(t);

    }

  }

  sort(oth.begin(), oth.end());

  oth.erase(unique(oth.begin(), oth.end()), oth.end());

  int lcm = 1;

  for(int i = 0; i < int(pri.size()); i++) {

    lcm = 1ll * lcm * fpow(pri[i], val[i]) % MOD;

  }

  for(auto &x: oth) lcm = 1ll * lcm * x % MOD;

  int ans = 0;

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

    ans += 1ll * lcm * fpow(v[i], MOD - 2) % MOD;

    if(ans >= MOD) ans -= MOD;

  }

  cout << ans << "\n";

}


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

#include<string>

#include<set>

#include<algorithm>

#include<vector>

#include<map>

#include<queue>

#include<iomanip>

#include<cmath>

#include<stack>

#define endl '\n'

#define Bedoazim ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);



using namespace std;



const long long mod = 1e9 + 7, N = 1e6 + 5;



long long fact[N], inv[N],  mix = 0, numbers[N];



map<long long, long long>factors;





long long fastpower(int base, int power) {



	if (power == 0)

		return 1;



	long long halfpower = fastpower(base, power / 2) ;



	long long ret = (halfpower * halfpower) % mod;



	if (power % 2) {



		ret = (ret * base) % mod;

	}

	return ret;





}





void primeFactors(long long n) {



	long long fact;



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



		fact = 0;



		while (n % i == 0) {



			fact++;



			n /= i;





		}

		if (factors[i] < fact) {



			factors[i] = fact;



		}









	}

	

	if (n > 1 && factors[n] < 1 ) {



		factors[n] = 1;



	}





	return;





}





int main() {



	Bedoazim



		long long n;



	cin >> n;



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





		cin >> numbers[i];



		primeFactors(numbers[i]);



	}





	long long lcm = 1;



	for (auto x : factors) {



		lcm =((lcm%mod)*(fastpower(x.first, x.second)%mod))%mod;

		



	}



	long long ans = 0;



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



		ans = ((ans%mod) + ((lcm * fastpower(numbers[i], mod - 2)) % mod)) % mod;



	}



	cout << ans%mod;





}

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

using namespace std;

#define ll long long

#define ull unsigned long long

#define mp make_pair

const ll mod=1e9+7;

typedef pair<int,int> pii;

typedef priority_queue<int,vector<int>,greater<int> > small_heap;

typedef priority_queue<int> big_heap;

int n;

ll a[10009];

ll mx[1000006];

ll power(ll aa,ll b)

{

    ll c=1;

    for(;b;b>>=1){

        if(b&1)c=c*aa%mod;

        aa=aa*aa%mod;

    }

    return c%mod;

}

int main()

{

    scanf("%d",&n);

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

        scanf("%lld",&a[i]);

        ll x=a[i];

        for(ll v=2;v*v<=x;v++){

            if(x%v)continue;

            ll cur=0;

            while(x%v==0){

                cur++;

                x/=v;

            }

            mx[v]=max(mx[v],cur);

        }

        if(x!=1)mx[x]=max(mx[x],1ll);

    }

    ll lcm=1;

    for(ll i=1;i<=1000006;i++)

    {

        if(mx[i]) lcm = (lcm * power(i, mx[i])) % mod;

    }

    log(lcm);

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

//        ll x=power(a[i]*prelcm,1);

//        ll y=power(__gcd(a[i],prelcm),mod-2);

//        prelcm=x%mod*y%mod;prelcm%=mod;

//    }

    ll sum=0;

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

        sum=(sum+power(lcm,1)%mod*power(a[i],mod-2)%mod)%mod;

    }

    cout<<sum<<endl;

    return 0;

}


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

#include<string>

#include<set>

#include<algorithm>

#include<vector>

#include<map>

#include<queue>

#include<iomanip>

#include<cmath>

#include<stack>

#define endl '\n'

#define Bedoazim ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);



using namespace std;



const long long mod = 1e9 + 7, N = 1e6 + 5;



long long fact[N], inv[N],  mix = 0, numbers[N];



map<long long, long long>factors;





long long fastpower(int base, int power) {



	if (power == 0)

		return 1;



	long long halfpower = fastpower(base, power / 2) ;



	long long ret = (halfpower * halfpower) % mod;



	if (power % 2) {



		ret = (ret * base) % mod;

	}

	return ret;





}





void primeFactors(long long n) {



	long long fact;



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



		fact = 0;



		while (n % i == 0) {



			fact++;



			n /= i;





		}

		if (factors[i] < fact) {



			factors[i] = fact;



		}









	}

	

	if (n > 1 && factors[n] < 1 ) {



		factors[n] = 1;



	}





	return;





}





int main() {



	Bedoazim



		long long n;



	cin >> n;



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





		cin >> numbers[i];



		primeFactors(numbers[i]);



	}





	long long lcm = 1;



	for (auto x : factors) {



		lcm =((lcm%mod)*(fastpower(x.first, x.second)%mod))%mod;

		



	}



	long long ans = 0;



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



		ans = ((ans%mod) + ((lcm * fastpower(numbers[i], mod - 2)) % mod)) % mod;



	}



	cout << ans%mod;





}

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

using namespace std;

typedef pair<int,double> P;

int main(){

  int n,m,p,a,b;

  while(cin>>n>>m>>p>>a>>b,n){

    a--,b--;



    double t[8],tp;

    vector<P> e[31];



    for(int i=0;i<n;i++)cin>>t[i];

    for(int j=0,x,y;j<p;j++){

      cin>>x>>y>>tp;

      x--,y--;

      e[x].push_back(P(y,tp)),e[y].push_back(P(x,tp));

    }



    double dp[1<<8][30];

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

	for(int j=0;j<m;j++)dp[i][j]=1e4;

    dp[0][a]=0;



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

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

	for(int k=0;k<m;k++)

	  for(int l=0;l<n;l++)

	    if(!(j&1<<l))

	      for(int w=0;w<e[k].size();w++)

		dp[j+(1<<l)][e[k][w].first]

	   =min(dp[j+(1<<l)][e[k][w].first],dp[j][k]+e[k][w].second/t[l]);



    double ans=1e4;

    for(int i=0;i<1<<n;i++)ans=min(ans,dp[i][b]);

    if(ans==1e4)cout<<"Impossible"<<endl;

    else cout<<ans<<endl;

  }

  return 0;

}

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

using namespace std;

typedef pair<int,double> P;

int main(){

  int n,m,p,a,b;

  while(cin>>n>>m>>p>>a>>b,n){

    a--,b--;



    double t[8],tp;

    vector<P> e[31];



    for(int i=0;i<n;i++)cin>>t[i];

    for(int j=0,x,y;j<p;j++){

      cin>>x>>y>>tp;

      x--,y--;

      e[x].push_back(P(y,tp)),e[y].push_back(P(x,tp));

    }



    double dp[1<<8][30];

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

	for(int j=0;j<m;j++)dp[i][j]=1e4;

    dp[0][a]=0;



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

      for(int k=0;k<m;k++)

	for(int l=0;l<n;l++)

	  if(!(j&1<<l))

	    for(int w=0;w<e[k].size();w++)

	      dp[j+(1<<l)][e[k][w].first]

		=min(dp[j+(1<<l)][e[k][w].first],dp[j][k]+e[k][w].second/t[l]);

    

    double ans=1e4;

    for(int i=0;i<1<<n;i++)ans=min(ans,dp[i][b]);

    if(ans==1e4)cout<<"Impossible"<<endl;

    else cout<<ans<<endl;

  }

  return 0;

}

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

#include<string>

#include<vector>

#include<cmath>

#include<queue>

#include<stack>

#include<set>

#include<algorithm>

#include<utility>

#include<map>

using namespace std;

typedef long long ll;

const int mod = 1000000007;

const int INF = 1001001001;



ll pow_mod(ll p, ll n, ll m) {

	if (n == 0) return 1;

	else if (n == 1) return p % m;

	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;

	else {

		ll tmp = pow_mod(p, n / 2, m);

		return (tmp * tmp) % m;

	}

}



ll gcd(ll x, ll y) {

	if (y == 0) {

		return x;

	}

	return gcd(y, x % y);

}



ll com_mod(ll n, ll k, ll m) {

	if (k == 0) return 1;

	else {

		ll x = 1;

		ll y = 1;

		for (ll i = 0; i < k; i++) {

			x = (x * (n - i)) % m;

			y = (y * (i + 1)) % m;

		}

		ll res = (x * pow_mod(y, m - 2, m)) % m;

		return res;

	}

}



int main() {

	int a, b;

	cin >> a >> b;

	if (a % 2 == 0 || b % 2 == 0)cout << "No" << endl;

	else cout << "Yes" << endl;

	return 0;

}

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

int main(){

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

  if(a%2==0||b%2==0) printf("No\n");

  else printf("Yes");

  return 0;

}


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

using namespace std;

int a,b;

main(){

  cin>>a>>b;

  cout<<(a*b%2?"Yes":"No")<<endl;

}

// Optimized solution to the same problem (faster):
#import<ios>

int a,b;main(){scanf("%d%d",&a,&b)<puts(a*b%2?"Yes":"No");}

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

#define model l,mid,num<<1

#define moder mid+1,r,num<<1|1

#define bug(k)  cout<<"text :"<<t<<endl

#define lowbit(k) k&-k

using namespace std;

typedef long long LL;

const LL mod=1e9+7;

const int M=1e5+5;

int main()

{

    int a,b;

    while(cin>>a>>b)

    {

        if((a&1)&&(b&1))puts("Yes");

        else puts("No");

    }

}


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

int main(void)

{

	int a, b, t, c, ji;

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

	if(a > b)

	{

		t = a;

		a = b;

		b = t;

	}

	for(int i = a; i <= b; i++)

	{

		c = i;

		ji = a*b*c;

		if(ji%2 == 1)

		break;

	}

	if(ji%2 == 0)

	printf("No");

	else

	printf("Yes");

	return 0;

 } 

// Fastest known solution for this problem: