#include #include #include using namespace std; using namespace atcoder; using mint = modint1000000007; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ vector isp(1000001,-1); vector p; for(int i=2;i>N; vector A(N); mint sum = 1; vector cnt(1000001,0); rep(i,N){ scanf("%d",&A[i]); cnt[A[i]]++; sum *= A[i]; } vector cnt2(1000001,0); rep(i,p.size()){ long long cur = p[i]; while(cur <= 1000000){ for(int j=cur;j<=1000000;j+=cur){ cnt2[cur] += cnt[j]; } if(cnt2[cur]>=2){ sum /= mint(p[i]).pow(cnt2[cur]-1); } cur *= p[i]; } } vector ans(N,0); //cout< mp; int t = A[i]; while(t!=1){ mp[isp[t]]++; t/=isp[t]; } for(auto a:mp){ int x = 1; rep(j,a.second){ x *= a.first; if(cnt2[x]>=2){ temp *= a.first; } } } ans[i] = temp; } sum = 1; rep(i,N){ sum *= A[i]; } rep(i,N){ ans[i] = sum / A[i] - ans[i]; } rep(i,N){ cout<