#include <bits/stdc++.h>

int main(){
#ifndef _DEBUG
	freopen("traverse.out","w",stdout);
#endif
	freopen("traverse.in","r",stdin);
	int T;scanf("%d",&T);
	int i1,i2,i3,i4;
	scanf("%d%d%d%d",&i1,&i2,&i3,&i4);
	std::mt19937 rd(T*i1*i2*i3*i4);
	std::uniform_int_distribution<int> r(0,1e9+7);
	while(T--){
		printf("%d\n",r(rd));
	}
}
