#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int S,T,N; cin >> S >> T >> N; vector> PAB(3); for(auto &[p,a,b] : PAB) cin >> p >> a >> b; long long inf = 1; for(int i=0; i<18; i++) inf *= 10; vector> dp(N+1,vector(T+1)); for(int i=0; i<=N; i++) dp.at(i).at(T) = inf; for(int i=N; i--;) for(int k=0; k X; for(int x=1; x<=k; x++){ long long now = 0; for(auto [p,a,b] : PAB){ int to = min(k-x+a*x/b,T); now += dp.at(i+1).at(to)/100*p; } if(now > big) big = now,X = {x}; else if(now == big) X.push_back(x); } if(i == 0 && k == S){ cout << big/(inf/100) << "\n"; cout << X.size() << "\n"; for(auto x : X) cout << x << "\n"; } dp.at(i).at(k) = big; } }