#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll d;
cin >> d;
vector<ll> contest_variety(26,0);
vector<ll> c(26,0);
rep(i,26){
    cin >> c[i];
}
vector<vector<ll>> calender(d,vector<ll> (26,0));
rep(i,d){
    rep(j,26){
        cin >> calender[i][j];
    }
}
vector<P> choose(d,{0,0});
rep(i,d){
    rep(j,26){
        if(choose[i].first < calender[i][j]){
            choose[i] = {calender[i][j],i};
        }
    }
}
ll ans = 0;
rep(i,d) {
    ans += choose[i].first;
    contest_variety[choose[i].second] = i + 1;
    rep(j,26){
        ans -= (j + 1) * (i + 1 - contest_variety[j]);
    }
    cout << ans << endl;
}

}