m.cpp
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <list>
#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
#define FILL(a,b) fill(a,a+SIZEOF(a),b)
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORARR(i,a) for(unsigned i=0; i<SIZEOF(a); i++)
#define FOREACH(a,b) for(__typeof((b).begin()) a = (b).begin(); a!=(b).end(); a++)
#define GETI(a) scanf("%d ", &a);
#define SWAP(a,b) { __typeof(a) t = a; a = t; b = t; }
using namespace std;
int main(void)
{
int M,P,L,E,R,S,N;
cin>>M>>P>>L>>E>>R>>S>>N;
while(!feof(stdin)){
while(N--) {
int M1,P1,L1;
M1=floor(P/S);
P1 = floor(L/R);
L1 = (M*E);
M=M1;
L=L1;
P=P1;
}
cout<<M<<endl;
cin>>M>>P>>L>>E>>R>>S>>N;
}
return 0;
}