mosquito.cpp
#include <iostream>
#include <algorithm>
#include <cassert>
#include <vector>
#include <cmath>
using namespace std;
int f3(int m, int e, int r, int s, int n)
{
for(; n>0; n-=3)
{
m = floor(floor((m*e)/float(r))/float(s));
}
return m;
}
int main()
{
while(true)
{
int M, P, L, E, R, S, N;
cin>>M>>P>>L>>E>>R>>S>>N;
if(!cin) break;
if(N%3==0)
{
M = f3(M, E, R, S, N);
}
else if(N%3==2)
{
M = floor(floor(L/float(R))/float(S));
M = f3(M, E, R, S, N);
}
else
{
M = floor(P/float(S));
M = f3(M, E, R, S, N);
}
cout << M << endl;
}
return 0;
}