//EU ITI SPUN DE LA INCEPUT CA CEEA CE AI TU ACOLO E GRESIT!!!
#include <iostream>
using namespace std;
int main() {
int n; cin>>n;
int a[n][n], b[n];
for (int i=1; i<=n; i++) {
for (int j=1; j<=n; j++) {
cin>>a[i][j];
}
}
for (int i=1; i<=n; i++) {
cin>>b[i];
}
for (j=n-1, j>=1; j--) {
for (int i=1; i<=n; i++) {
b[i][j]=0;
for (int k=1; k<=n; k++) {
b[i][j]=b[i][j]+a[i][k]*b[k][j+1];
}
}
}
for (int i=1; i<=n; i++) {
b[i][n+1]=0;
for (int k=1; k<=n; k++) {
b[i][n+1]=b[i][n+1]+a[i][k]*b[k][1];
}
b[i][n+1]=-b[i][n+1];
}
return 0;
}