#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#define MAX_N 100000
using namespace std;

int N, M, c;

int ori[MAX_N];
int cri[MAX_N];
long long somma[MAX_N+1];

int main(void)
{
	cin >> N >> M >> c;
	for(int i=0;i<N;i++)
		cin >> ori[i];
	for(int i=0;i<M;i++)
		cin >> cri[i];
	for(int i=0;i<M;i++)
		somma[i+1]=(long long)somma[i]+cri[i];
	/*for(int i=0;i+M-1<N;i++)
		for(int k=0;k<M;k++)
			ori[i+k]=(ori[i+k]+cri[k])%c;*/
	for(int i=0;i<N;i++)
	{
		//int passanti=M;
		//passanti=min(passanti, i+1);
		//passanti=min(passanti, N-i);
		int first=max(0, i-N+M);
		int lastpassante=M-1;
		lastpassante=min(lastpassante, i);
		//cout << i << " " << lastpassante << " " << first << somma[lastpassante+1]-somma[first] << endl;
		ori[i]+=somma[lastpassante+1]-somma[first];
		ori[i]%=c;
	}
	for(int i=0;i<N;i++)
		cout << ori[i] << " ";
	return 0;
}


#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#define MAX_N 100000
using namespace std;

int N, M, c;

int ori[MAX_N];
int cri[MAX_N];
long long somma[MAX_N+1];

int main(void)
{
	cin >> N >> M >> c;
	for(int i=0;i<N;i++)
		cin >> ori[i];
	for(int i=0;i<M;i++)
		cin >> cri[i];
	for(int i=0;i<M;i++)
		somma[i+1]=(long long)somma[i]+cri[i];
	for(int i=0;i<N;i++)
	{
		int passanti=M;
		passanti=min(passanti, i+1);
		passanti=min(passanti, N-i);

		int lastpassante=M-1;
		lastpassante=min(lastpassante, i);
	//	cout << i << " " << lastpassante << " " << passanti << endl;
		ori[i]+=somma[lastpassante+1]-somma[lastpassante-passanti+1];
		ori[i]%=c;
	}
	for(int i=0;i<N;i++)
		cout << ori[i] << " ";
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
#include <vector>
#include <queue>
#include <deque>
#include <utility>
#include <iomanip>
#include <memory.h>
#include <string>
#include <ext/rope>
#include <iterator>

using namespace std;
using namespace __gnu_cxx;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz size
#define scf scanf
#define prf printf
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define gcd(a,b) __gcd(a,b)
#define getBit(x,i) ((x&(1<<i))!=0 ? 1 : 0)
#define For(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,begin,end,move) for (int i = begin; i != end; i += move)

typedef long long ll;

const ll base = 1000000007LL;
const ll INF = 10000000000000LL;

int n, m, c;
int a[100001];
int b[100001];
int ans[100001] = {0};
int psum[100001] = {0};
int sum[100001] = {0};

int main()
{
    scf("%d%d%d", &n, &m, &c);
    For(i, n)
        scf("%d", &a[i]);
    For(j, m)
        scf("%d", &b[j]);
    int curSum = 0;
    For(i, n)
    {
        if (i < m)
            curSum += b[i];
        else
            if (i > n - m)
                curSum -= b[i - n + m - 1];
        prf("%d ", (a[i] + curSum) % c);
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
#include <vector>
#include <queue>
#include <deque>
#include <utility>
#include <iomanip>
#include <memory.h>
#include <string>
#include <ext/rope>
#include <iterator>

using namespace std;
using namespace __gnu_cxx;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz size
#define scf scanf
#define prf printf
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define gcd(a,b) __gcd(a,b)
#define getBit(x,i) ((x&(1<<i))!=0 ? 1 : 0)
#define For(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,begin,end,move) for (int i = begin; i != end; i += move)

typedef long long ll;

const ll base = 1000000007LL;
const ll INF = 10000000000000LL;

int n, m, c;
int a[100001];
int b[100001];
int ans[100001] = {0};
int psum[100001] = {0};
int sum[100001] = {0};

int main()
{
    scf("%d%d%d", &n, &m, &c);
    For(i, n)
        scf("%d", &a[i]);
    For(j, m)
        scf("%d", &b[j]);
    int curSum = 0;
    For(i, n)
    {
        if (i < m)
            curSum += b[i];
        if (i > n - m)
                curSum -= b[i - n + m - 1];
        prf("%d ", (a[i] + curSum) % c);
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <cassert>
#include <list>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define REP(i,n) for(int i=0, _n=n; i<_n; i++)
#define FOREACH(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)

using namespace std;
const int INF=1000000000;
int main()
{
    ios_base::sync_with_stdio(false);

    int N, M, MOD;
    cin>>N>>M>>MOD;

    vector<long long> a(N);
    vector<int> b(M);
    REP(i,N) cin>>a[i];
    REP(i,M) cin>>b[i];

    vector<long long> sumbto(M), sumbfrom(M);
    sumbto[0]=b[0];
    for(int i=1; i<M; i++) sumbto[i]=(sumbto[i-1]+b[i]);
    sumbfrom[M-1]=b[M-1];
    for(int i=M-2; i>=0; i--) sumbfrom[i]=(sumbfrom[i+1]+b[i]);

	REP(i,N) a[i]+=sumbfrom[0];

	REP(i,M-1) a[i] -= sumbfrom[i+1];

	REP(i,M-1) a[N-i-1] -= sumbto[M-i-2];

	REP(i,N) {
		if(i) cout<<" ";
		cout<<a[i]%MOD;
	}
	cout<<endl;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <cassert>
#include <list>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define REP(i,n) for(int i=0, _n=n; i<_n; i++)
#define FOREACH(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)

using namespace std;
const int INF=1000000000;
int main()
{
    ios_base::sync_with_stdio(false);

    int N, M, MOD;
    cin>>N>>M>>MOD;

    vector<int> a(N);
    vector<int> b(M);
    REP(i,N) cin>>a[i];
    REP(i,M) cin>>b[i];

    vector<int> sumbto(M), sumbfrom(M);
    sumbto[0]=b[0];
    for(int i=1; i<M; i++) sumbto[i]=(sumbto[i-1]+b[i])%MOD;
    sumbfrom[M-1]=b[M-1];
    for(int i=M-2; i>=0; i--) sumbfrom[i]=(sumbfrom[i+1]+b[i])%MOD;

	int p=0, q=N-1;
	for(; p<q && p<M; p++, q--) {
		a[p]=(a[p]+sumbto[p])%MOD;
		a[N-p-1]=(a[N-p-1]+sumbfrom[M-p-1])%MOD;
	}
	for(int i=p; i<=q; i++)
		a[i] = (a[i]+sumbfrom[0])%MOD;

	REP(i,N) {
		if(i) cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <cassert>
#include <list>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define REP(i,n) for(int i=0, _n=n; i<_n; i++)
#define FOREACH(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)

using namespace std;
const int INF=1000000000;
int main()
{
    ios_base::sync_with_stdio(false);

    int N, M, MOD;
    cin>>N>>M>>MOD;

    vector<long long> a(N);
    vector<int> b(M);
    REP(i,N) cin>>a[i];
    REP(i,M) cin>>b[i];

    vector<long long> sumbto(M), sumbfrom(M);
    sumbto[0]=b[0];
    for(int i=1; i<M; i++) sumbto[i]=(sumbto[i-1]+b[i]);
    sumbfrom[M-1]=b[M-1];
    for(int i=M-2; i>=0; i--) sumbfrom[i]=(sumbfrom[i+1]+b[i]);

	int p=0, q=N-1;
	for(; p<q && p<M; p++, q--) {
		a[p]+=sumbto[p];
		a[N-p-1]+=sumbfrom[M-p-1];
	}
	for(int i=p; i<=q; i++)
		a[i] += sumbfrom[0];

	REP(i,N) {
		if(i) cout<<" ";
		cout<<a[i]%MOD;
	}
	cout<<endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::vector;

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> mes(n), cipher(n, 0);
    vector<int> code(m);
    int count = n - m + 1;
    for (int i = 0; i < n; ++i)
        cin >> mes[i];
    for (int j = 0; j < m; ++j)
        cin >> code[j];
    cipher = mes;

    vector<int> sums(m * 2 - 1);
    for (int i = 0; i < sums.size(); ++i) {
        if (i == 0)
            sums[0] = code[0];
        else if (i < m) {
                sums[i] = sums[i - 1] + code[i];
             } else if (i >= m) {
                        sums[i] = sums[m - 1] - sums[i - m];
                    }
    }
    int st = m - 1;
    if (st > count - 1)
        st = count - 1;
    int st_const = 0;
    if (st <= n / 2)
        st_const = n - 2 * st;
/*
cout << st << " " << st_const << "\n";
for (int i = 0; i < sums.size(); ++i)
    cout << sums[i] << "|";
cout << "\n";
*/
    for (int i = 0; i < st; ++i) {
        cipher[i] += sums[i];
        cipher[i] %= c;
    }
    if (st == m - 1) {
        for (int i = st; i < st + st_const; ++i) {
            cipher[i] += sums[st];
            cipher[i] %= c;
        }
    } else {// count - 1
        for (int i = st; i < st + st_const; ++i) {
            for (int j = 0; j < count; ++j)
                cipher[i] += code[i - j];
            cipher[i] %= c;
        }
    }
    for (int i = n - 1; i >= st + st_const; --i) {
        cipher[i] += sums[sums.size() - n + i];
        cipher[i] %= c;
    }

    for (int i = 0; i < n; ++i) {
        cout << cipher[i];
        if (i != n - 1)
            cout << " ";
        else
            cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::vector;

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> mes(n), cipher(n, 0);
    vector<int> code(m);
    int count = n - m + 1;
    for (int i = 0; i < n; ++i)
        cin >> mes[i];
    for (int j = 0; j < m; ++j)
        cin >> code[j];
    cipher = mes;

    vector<int> sums(m * 2 - 1);
    for (int i = 0; i < sums.size(); ++i) {
        if (i == 0)
            sums[0] = code[0];
        else if (i < m) {
                sums[i] = sums[i - 1] + code[i];
             } else if (i >= m) {
                        sums[i] = sums[m - 1] - sums[i - m];
                    }
    }
    int st = m - 1;
    if (st > count - 1)
        st = count - 1;
    int st_const = 0;
    if (st <= n / 2)
        st_const = n - 2 * st;
/*
cout << st << " " << st_const << "\n";
for (int i = 0; i < sums.size(); ++i)
    cout << sums[i] << "|";
cout << "\n";
*/
    for (int i = 0; i < st; ++i) {
        cipher[i] += sums[i];
        cipher[i] %= c;
    }
    if (st == m - 1) {
        for (int i = st; i < st + st_const; ++i) {
            cipher[i] += sums[st];
            cipher[i] %= c;
        }
    } else {// count - 1
        int sum = 0;
        for (int i = st; i < st + st_const; ++i) {
            if (i == st) {
                for (int j = 0; j < count; ++j) {
                    cipher[i] += code[i - j];
                    sum += code[i - j];
                }
            } else {
                sum += code[i] - code[i - count];
                cipher[i] += sum;
            }
            cipher[i] %= c;
        }
    }
    for (int i = n - 1; i >= st + st_const; --i) {
        cipher[i] += sums[sums.size() - n + i];
        cipher[i] %= c;
    }

    for (int i = 0; i < n; ++i) {
        cout << cipher[i];
        if (i != n - 1)
            cout << " ";
        else
            cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>

#define LL long long
#define PI acos(-1.0)//¶¨ÒåPI
#define eps 1e-6//¶¨Òå¾«¶È
using namespace std;

int dir1[8][2] = {1,2,2,1,2,-1,1,-2,-1,2,-2,1,-1,-2,-2,-1};//¹ú¼ÊÏóÆå

int dir2[4][2] = {1,0,0,1,-1,0,0,-1};//Ö»ÄÜ×ßÉÏÏÂ×óÓÒËÄ¸ö·½Î»

int dir3[8][2] = {1,0,0,1,-1,0,0,-1,1,1,1,-1,-1,1,-1,-1};//¿ÉÒÔ×ßÉÏÏÂ×óÓÒ×óÉÏ×óÏÂÓÒÉÏÓÒÏÂ°Ë¸ö·½Î»

int gcd(int x,int y)//Çó×î´ó¹«Ô¼Êý
{
    return y==0?x:gcd(y,x%y);
}

bool isPrime(int x)//ÅÐËØÊý
{
    if(x==1)
        return false;
    else if(x==2)
        return true;
    for(int i=2;i<=sqrt(x*1.0);++i)
    {
        if(x%i == 0)
            return false;
    }
    return true;
}

int sqr(int x)
{
    return x * x;
}

int n,m,c,t;
int a[100020];
int b[100020];
int main()
{
	scanf("%d %d %d",&n,&m,&c);
	for(int i=0;i<n;i++)
		scanf("%d",a+i);
	for(int i=0;i<m;i++)
		scanf("%d",b+i);
	for(int i=0;i<n;i++)
	{
		if(i<m)
			t+=b[i];
		if(i>n-m)
			t-=b[i-n+m-1];
		printf("%d ",(a[i]+t)%c);
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>

#define LL long long
#define PI acos(-1.0)//¶¨ÒåPI
#define eps 1e-6//¶¨Òå¾«¶È
using namespace std;

int dir1[8][2] = {1,2,2,1,2,-1,1,-2,-1,2,-2,1,-1,-2,-2,-1};//¹ú¼ÊÏóÆå

int dir2[4][2] = {1,0,0,1,-1,0,0,-1};//Ö»ÄÜ×ßÉÏÏÂ×óÓÒËÄ¸ö·½Î»

int dir3[8][2] = {1,0,0,1,-1,0,0,-1,1,1,1,-1,-1,1,-1,-1};//¿ÉÒÔ×ßÉÏÏÂ×óÓÒ×óÉÏ×óÏÂÓÒÉÏÓÒÏÂ°Ë¸ö·½Î»

int gcd(int x,int y)//Çó×î´ó¹«Ô¼Êý
{
    return y==0?x:gcd(y,x%y);
}

bool isPrime(int x)//ÅÐËØÊý
{
    if(x==1)
        return false;
    else if(x==2)
        return true;
    for(int i=2;i<=sqrt(x*1.0);++i)
    {
        if(x%i == 0)
            return false;
    }
    return true;
}

int sqr(int x)
{
    return x * x;
}

int a[100005];
int b[100005];
int sum[100005];

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,m,c;

    while(~scanf("%d %d %d",&n,&m,&c))
    {
        memset(sum,0,sizeof(sum));
        int ans = 0;

        for(int i = 0; i < n; ++i)
            scanf("%d",&a[i]);

        for(int i = 0; i < m; ++i)
            scanf("%d",&b[i]);

        for (int i = 0; i < n - m + 1; ++i)
        {
            for(int j = 0; j < m; ++j)
            {
                a[i + j] = (a[i + j] + b[j]) % c;
            }
        }

        for (int i = 0; i < n; ++i)
        {
            if(i == n - 1)
                printf("%d\n",a[i]);
            else
                printf("%d ",a[i]);
        }

    }
    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;
int num1[100010];
int num2[100010];
int n,m,c;
int find(int i,int j)
{
  if(i<0)
  return num2[j];
  return num2[j]-num2[i];
}
int main()
{
    cin>>n>>m>>c;
    for(int i=0;i<n;i++)
    scanf("%d",num1+i);
    for(int i=0;i<m;i++)
    scanf("%d",num2+i);
    for(int i=m;i<n;i++)
    num2[i]=0;
    for(int i=1;i<n;i++)
    num2[i]+=num2[i-1];
    for(int i=0;i<n;i++)
    {
      num1[i]+=find(i-(n-m+1),i);
      num1[i]%=c;
    }
    for(int i=0;i<n;i++)
    {
       cout<<num1[i]<<" ";
    }
    cout<<"\n";
    return 0;
}


/**
 * @author neko13
 */
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
using namespace std;
// 13C
#define DBG 0
#define sz(c) ((int)(c).size())
#define   forl(i, a, b) for(int i = (a); i <  (b); ++i)
#define  forle(i, a, b) for(int i = (a); i <= (b); ++i)
#define   forg(i, a, b) for(int i = (a); i >  (b); --i)
#define  forge(i, a, b) for(int i = (a); i >= (b); --i)
#define  forlc(i, a, b) for(int i##_b = (b), i = (a); i <  i##_b; ++i)
#define forlec(i, a, b) for(int i##_b = (b), i = (a); i <= i##_b; ++i)
#define  forgc(i, a, b) for(int i##_b = (b), i = (a); i >  i##_b; --i)
#define forgec(i, a, b) for(int i##_b = (b), i = (a); i >= i##_b; --i)
#define forall(i, v   ) forlc(i, 0,   sz(v))
#define forlla(i, v   ) forge(i, sz(v)-1, 0)
#define  forls(i, n, a, b) for(int i = a; i != b; i = n[i])
#define rep(n)  for(int               repp = 0; repp <    (n); ++repp)
#define repc(n) for(int repp_b = (n), repp = 0; repp < repp_b; ++repp)
#define rst(a, v) memset(a, v, sizeof a)
#define cpy(a, b) memcpy(a, b, sizeof a)
#define rstn(a, v, n) memset(a, v, (n)*sizeof((a)[0]))
#define cpyn(a, b, n) memcpy(a, b, (n)*sizeof((a)[0]))
#define pr(x) #x"=" << (x) << " | "
#define dout  DBG && cerr << __LINE__ << ">>| "
#define mk(x) DBG && cerr << __LINE__ << "**| "#x << endl
#define dlist(args...) DBG && (dout << #args", = ", (void)(dbgr, args), cerr << " |" << endl)
#define ast(b) if(DBG && !(b)) { fprintf(stderr, "%d!!|\n", __LINE__); while(1) getchar(); }
#define pra(arr, a, b) if(DBG) { \
    dout<<#arr"[] | "; \
    forlec(i, a, b) cerr<<"["<<i<<"]="<<arr[i]<<" |"<<((i-(a)+1)%13?" ":"\n"); \
    if(((b)-(a)+1)%13) cerr<<endl; \
  }
#define rd(type, x) type x; cin >> x
inline int     rdi() { int d; scanf("%d", &d); return d; }
inline char    rdc() { scanf(" "); return getchar(); }
inline string  rds() { rd(string, s); return s; }
inline double rddb() { double d; scanf("%lf", &d); return d; }
template<class T> inline bool setmin(T& a, T b) { return a>b? a=b, true: false; }
template<class T> inline bool setmax(T& a, T b) { return a<b? a=b, true: false; }
struct debugger { template<typename T> debugger& operator , (const T& x) { cerr << x << ","; return *this; } } dbgr;

const int N = 131072;

int n, m, c, a[N], b[N];

int main() {
  n = rdi(), m = rdi(), c = rdi();
  forle(i, 1, n) a[i] = rdi();
  forle(i, 1, m) b[i] = rdi();
  forle(i, 1, n) b[i] = (b[i]+b[i-1])%c;
  forle(i, 1, n) printf("%d%c", (a[i]+b[i]-b[max(0, i-(n-m)-1)]+c)%c, i<n?' ':'\n');
  return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (m+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	if( l ) {
		j = m-2;

		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + rb[j--] ) % c;
		}
	} else {
		j = 0;
		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + b[j++] ) % c;
		}
	}

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (m+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	j = m-2;

	FOR( i,l+1,n-1 ) {
		a[i] = ( 1LL*a[i] + rb[j--] ) % c;
	}

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (m+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
//	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
//	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
//		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
//		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	int st = sb[l];

	j = 0;
	int k = l+1;
	int temp;

	FOR( i,l+1,n-1 ) {
		if( k < m ) {
			temp = (st-b[j]+b[k]) % c;
		} else {
			temp = (st-b[j]) % c;
		}

		a[i] = ( 1LL*a[i] + ( st - b[j++] + ( k < m ? b[k++] : 0 ) ) ) % c;
		st = temp;
	}
	/*
	if( l ) {
		j = m-2;

		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + rb[j--] ) % c;
		}
	} else {
		j = 0;
		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + b[j++] ) % c;
		}
	}*/

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (m+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
//	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
//	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
//		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
//		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	int st = sb[l];

	j = 0;
	int k = l+1;
	int temp;

	FOR( i,l+1,n-1 ) {
		if( k < m ) {
			temp = (1LL*st-b[j]+b[k]) % c;
		} else {
			temp = (1LL*st-b[j]) % c;
		}

		a[i] = ( 1LL*a[i] + ( 1LL*st - b[j++] + ( k < m ? b[k++] : 0 ) ) ) % c;
		st = temp;
	}
	/*
	if( l ) {
		j = m-2;

		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + rb[j--] ) % c;
		}
	} else {
		j = 0;
		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + b[j++] ) % c;
		}
	}*/

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (n+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
//	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
//	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
//		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
//		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	int st = sb[l];

	j = 0;
	int k = l+1;
	int temp;

	FOR( i,l+1,n-1 ) {
		if( k < m ) {
			temp = (1LL*st-b[j]+b[k] + c) % c;
		} else {
			temp = (1LL*st-b[j]+c) % c;
		}

		a[i] = ( 1LL*a[i] + ( 1LL*st - b[j++] + ( k < m ? b[k++] : 0 ) ) + c ) % c;
		st = temp;
	}
	/*
	if( l ) {
		j = m-2;

		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + rb[j--] ) % c;
		}
	} else {
		j = 0;
		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + b[j++] ) % c;
		}
	}*/

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


/*******************************************************************************************************************************************
* File Name   : d.cpp
* Development : Saturday 21 April 2012 09:07:51 PM IST
* Author      : Xeronix
*******************************************************************************************************************************************/

#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>

//#include ".prettyprint.hpp"

#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))

//#define LIM
#ifdef LIM
	int S, D, Y, O;
	char *inp, *out, *ipos, *opos, DIG[30];
	#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
	#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
	#define FWO fwrite_unlocked( out,opos-out,1,stdout );
        #define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
	#define PUTI(O) n=O;D=0;if(n<0){*opos++='-';n*=-1;}if(!n)*opos++='0';else{while(n){Y=n/10;DIG[D++]=n-Y*10+'0';n=Y;}\
	while(D--)*opos++=DIG[D];}
	#define PUTC(c) *opos++=c;
#endif

using namespace std;

int main()
{
	int n, m, c;
	int i, j;

	scanf( "%d%d%d", &n, &m, &c );

	int *a = ( int * )malloc( (n+1)*sizeof( int ) );
	int *b = ( int * )malloc( (m+1)*sizeof( int ) );
	int *sb = ( int * )malloc( (n+1)*sizeof( int ) );
	int *rb = ( int * )malloc( (n+1)*sizeof( int ) );

	FOR( i,0,n-1 ) {
		scanf( "%d", &a[i] );
	}

	FOR( i,0,m-1 ) {
		scanf( "%d", &b[i] );
	}

	sb[0] = b[0];
	rb[0] = b[m-1];

	FOR( i,1,m-1 ) {
		sb[i] = ( 1LL*sb[i-1] + b[i] ) % c ;
		rb[i] = ( 1LL*rb[i-1] + b[m-i-1] ) % c;
//		cout << i << " " << sb[i] << " " << rb[i] << endl;
	}

	FOR( i,m,n-1 ) {
		sb[i] = sb[i-1];
		rb[i] = rb[i-1];
	}
/*
	int l = n-m+1;

	i = 0;

	while( l-- ) {
		FOR( j,0,m-1 ) {
			a[i+j] += b[j];
		}
		i++;
	}

	FOR( i,0,n-1 ) {
		a[i] %= c;
		printf( "%d ", a[i] );
	}*/

	int l = n-m;

	FOR( i,0,l ) {
		a[i] = ( 1LL*a[i] + sb[i] ) % c;
	}

	int st = sb[l];

	j = 0;
	int k = l+1;
	int temp;

	FOR( i,l+1,n-1 ) {
		if( k < m ) {
			temp = st-b[j]+b[k];
		} else {
			temp = st-b[j];
		}

		a[i] = ( 1LL*a[i] + ( st - b[j++] + ( k < m ? b[k++] : 0 ) ) ) % c;
		st = temp;
	}
	/*
	if( l ) {
		j = m-2;

		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + rb[j--] ) % c;
		}
	} else {
		j = 0;
		FOR( i,l+1,n-1 ) {
			a[i] = ( 1LL*a[i] + b[j++] ) % c;
		}
	}*/

	FOR( i,0,n-1 ) {
		printf( "%d ", a[i] );
	}

	return 0;
}


#include<cstdio>

using namespace std;

int main(void){

    int a[100024], b, n, m, c;

    scanf("%d %d %d", &n, &m, &c);

    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }

    int steps = n - m + 1;

    for(int i = 0; i < m; ++i){
        scanf("%d", &b);
        for(int j = 0; j < steps; ++j) a[i+j]+=b;
    }

    for(int i = 0; i < n; ++i){
        a[i] %= c;
        printf("%d", a[i]);
        if(i != n-1) printf(" ");
    }

    printf("\n");

    return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;

int main(void){

    int a[100024], b[100024], n, m, c;

    memset(b, 0, sizeof(b));

    scanf("%d %d %d", &n, &m, &c);

    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }

    for(int i = 0; i < m; ++i){
        scanf("%d", &b[i]);
    }

    int steps = n - m + 1;
    int s = 0;

    for(int i = 0; i < steps; ++i){
        s += b[i];
        a[i] += s;
        a[i] %= c;

        printf("%d", a[i]);
        if(i != n-1) printf(" ");
    }

    for(int i = steps; i < n; ++i){
        s -= b[i-steps];
        if(i < m) s += b[i];

        a[i] += s;
        a[i] %= c;

        printf("%d", a[i]);
        if(i != n-1) printf(" ");
    }

    printf("\n");

    return 0;
}


#include<cstdio>

using namespace std;

int main(void){

    int a[100024], b[100024], n, m, c;

    scanf("%d %d %d", &n, &m, &c);

    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }

    int steps = n - m + 1;

    for(int i = 0; i < m; ++i){
        scanf("%d", &b[i]);
    }

    int s = 0;

    for(int i = 0; i < steps; ++i){
        s += b[i];
        a[i] += s;
        a[i] %= c;

        printf("%d", a[i]);
        if(i != n-1) printf(" ");
    }

    for(int i = steps; i < n; ++i){
        s -= b[i-steps];
        if(i < m) s += b[i];

        a[i] += s;
        a[i] %= c;

        printf("%d", a[i]);
        if(i != n-1) printf(" ");
    }

    printf("\n");

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) For(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) For(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

typedef pair<int, int> II;

const ld PI = acos(ld(-1.0));
const ld eps = 1e-9;

const int inf = (int)1e9 + 5;
const ll linf = (ll)1e17 + 5;
int dr[8] = {-1, +1, 0, 0, +1, +1, -1, -1};
int dc[8] = {0, 0, +1, -1, -1, +1, -1, +1};
const ll mod = 1000000007;

#define maxn 400005

int n, m, c;
int sum[maxn], a[maxn], x;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("in.txt", "r", stdin);
    cin >> n >> m >> c;
    For(i, 1, n) cin >> a[i];
    ms(sum, 0);
    For(i, 1, m){
        cin >> x;
        sum[i] = (sum[i - 1] + x) % c;
    }

    For(i, 1, n){
        int res = a[i];
        int l = max(1, m - (n - i));
        int r = min(m, i);
//      cout << l << " " << r << endl;
        res = (res + sum[r] - sum[l - 1]) % c;
        if(res < 0) res += c;
        cout << res << " ";
    }

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
#define Fit(i,v) For(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define Fitd(i,v) For(__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))

template<class F, class T> T convert(F a, int p = -1) { stringstream ss; if (p >= 0) ss << fixed << setprecision(p); ss << a; T r; ss >> r; return r; }
template<class T> T gcd(T a, T b) { T r; while (b != 0) { r = a % b; a = b; b = r; } return a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sqr(T x) { return x * x; }
template<class T> T cube(T x) { return x * x * x; }
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s); }
const int bfsz = 1 << 16; char bf[bfsz + 5]; int rsz = 0;int ptr = 0;
char gc() { if (rsz <= 0) { ptr = 0; rsz = (int) fread(bf, 1, bfsz, stdin); if (rsz <= 0) return EOF; } --rsz; return bf[ptr++]; }
void ga(char &c) { c = EOF; while (!isalpha(c)) c = gc(); }
int gs(char s[]) { int l = 0; char c = gc(); while (isspace(c)) c = gc(); while (c != EOF && !isspace(c)) { s[l++] = c; c = gc(); } s[l] = '\0'; return l; }
template<class T> bool gi(T &v) {
    v = 0; char c = gc(); while (c != EOF && c != '-' && !isdigit(c)) c = gc(); if (c == EOF) return false; bool neg = c == '-'; if (neg) c = gc();
    while (isdigit(c)) { v = v * 10 + c - '0'; c = gc(); } if (neg) v = -v; return true;
}

typedef pair<int, int> II;

const ld PI = acos(ld(-1.0));
const ld eps = 1e-9;

const int inf = (int)1e9 + 5;
const ll linf = (ll)1e17 + 5;
int dr[8] = {-1, +1, 0, 0, +1, +1, -1, -1};
int dc[8] = {0, 0, +1, -1, -1, +1, -1, +1};
const ll mod = 1000000007;

#define maxn 400005

int n, m, c;
int sum[maxn], a[maxn], x;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("in.txt", "r", stdin);
    cin >> n >> m >> c;
    For(i, 1, n) cin >> a[i];
    ms(sum, 0);
    For(i, 1, m){
        cin >> x;
        sum[i] = (sum[i - 1] + x) % c;
    }

    For(i, 1, n){
        int res = a[i];
        int l = max(1, m - (n - i));
        int r = min(m, i);
        res = (res + sum[r] - sum[l - 1]) % c;
        cout << res << " ";
    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

unsigned int min(unsigned int a, unsigned int b)
{
	if(a<b)
		return a;
	return b;
}

int main()
{
	unsigned int m, n, c;
	cin >> m >> n >> c;
	vector<unsigned int> a;
	a.resize(m);
	vector<unsigned int> b;
	b.resize(n);
	for(unsigned int i=0; i<m; i++)
		cin >> a[i];
	for(unsigned int i=0; i<n; i++)
		cin >> b[i];

	for(unsigned int i=0; i<m-n+1; i++)
	{
		for(unsigned int j=0; i+j<m && j<n; j++)
			a[i+j] = (a[i+j]+b[j])%c;
	}
	for(unsigned int i=0; i<m; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	unsigned int m, n;
	unsigned short c;
	cin >> m >> n >> c;
	vector<unsigned short> a;
	a.resize(m);
	vector<unsigned short> b;
	b.resize(n);
	for(unsigned short i=0; i<m; i++)
		cin >> a[i];
	for(unsigned short i=0; i<n; i++)
		cin >> b[i];

	for(unsigned short i=0; i<m-n+1; i++)
	{
		for(unsigned short j=0; j<n; j++)
			a[i+j] = (a[i+j]+b[j])/*%c*/;
	}
	for(unsigned short i=0; i<m; i++)
		cout << a[i]%c << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	vector<int> bb;
	bb.resize(2*n-1);
	bb[0] = b[0];
	//cout << bb[0] << " ";
	for(int i=1; i<n; i++)
	{
		bb[i] = bb[i-1] + b[i];
	//	cout << bb[i] << " ";
	}

	for(int i=0; i<n-1; i++)
	{
		bb[n+i] = bb[n+i-1] - b[i];
	//	cout << bb[n+i] << " ";
	}
	//cout << 'a' << endl;

	/*for(int i=0; i<m-n+1; i++)
	{
		for(int j=0; j<n; j++)
			a[i+j] = (a[i+j]+b[j])%c;
	}*/
	for(int i=0; i<n-1; i++)
		cout << (a[i] + bb[i])%c << " ";
	for(int i=n-1; i<m-n+1; i++)
		cout << (a[i] + bb[n-1])%c << " ";
	for(int i=m-n+1; i<m; i++)
		cout << (a[i] + bb[2*n+i-1-m])%c << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

unsigned int min(unsigned int a, unsigned int b)
{
	if(a<b)
		return a;
	return b;
}

int main()
{
	unsigned int m, n, c;
	cin >> m >> n >> c;
	vector<unsigned int> a;
	a.resize(m);
	vector<unsigned int> b;
	b.resize(n);
	for(unsigned int i=0; i<m; i++)
		cin >> a[i];
	for(unsigned int i=0; i<n; i++)
		cin >> b[i];

	for(unsigned int i=0; i<m-n+1; i++)
	{
		for(unsigned int j=0; i+j<m && j<n; j++)
			a[i+j] = (a[i+j]+b[j])/*%c*/;
	}
	for(unsigned int i=0; i<m; i++)
		cout << a[i]%c << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	vector<int> bb;

	if(2*n-m<3)
	{
		bb.resize(2*n-1);
		bb[0] = b[0]%c;
		for(int i=1; i<n; i++)
		{
			bb[i] = (bb[i-1] + b[i])%c;
		}

		for(int i=0; i<n-1; i++)
		{
			bb[n+i] = (bb[n+i-1] - b[i])%c;
			if(bb[n+i] < 0)
				bb[n+i] += c;
		}

		for(int i=0; i<2*n-1; i++)
			bb[i] %= c;

		int i;
		for(i=0; i<n-1; i++)
			cout << (a[i] + bb[i])%c << " ";
		for(; i<m-n+1; i++)
			cout << (a[i] + bb[n-1])%c << " ";
		for(; i<m; i++)
			cout << (a[i] + bb[2*n+i-1-m])%c << " ";
		cout << endl;
	}
	else
	{
		int maxRow = m-n+1;
		bb.resize(m);
		bb[0] = b[0];
		cout << (a[0] + b[0])%c << " ";
		for(int i=1; i<maxRow; i++)
		{
			bb[i] = (bb[i-1] + b[i])%c;
			cout << (a[i] + bb[i])%c << " ";
		}
		for(int i=maxRow; i<n; i++)
		{
			bb[i] = (bb[i-1] - b[i-maxRow] + b[i])%c;
			if(bb[i] < 0)
				bb[i] += c;
			cout << (a[i] + bb[i])%c << " ";
		}
		for(int i=n; i<m; i++)
		{
			bb[i] = (bb[i-1] - b[i-maxRow])%c;
			if(bb[i] < 0)
				bb[i] += c;
			cout << (a[i] + bb[i])%c << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	unsigned int m, n;
	unsigned short c;
	cin >> m >> n >> c;
	vector<unsigned short> a;
	a.resize(m);
	vector<unsigned short> b;
	b.resize(n);
	for(unsigned short i=0; i<m; i++)
		cin >> a[i];
	for(unsigned short i=0; i<n; i++)
		cin >> b[i];

	for(unsigned short i=0; i<m-n+1; i++)
	{
		for(unsigned short j=0; j<n; j++)
			a[i+j] = (a[i+j]+b[j])%c;
	}
	for(unsigned short i=0; i<m; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	for(int i=0; i<m-n+1; i++)
	{
		for(int j=0; j<n; j++)
			a[i+j] = (a[i+j]+b[j])%c;
	}
	for(int i=0; i<m; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	vector<int> bb;
	bb.resize(2*n-1);
	bb[0] = b[0];
	for(int i=1; i<n; i++)
	{
		bb[i] = bb[i-1] + b[i];
	}

	for(int i=0; i<n-1; i++)
	{
		bb[n+i] = bb[n+i-1] - b[i];
	}

	for(int i=0; i<2*n-1; i++)
		bb[i] %= c;
	for(int i=0; i<n-1; i++)
		cout << (a[i] + bb[i])%c << " ";
	for(int i=n-1; i<m-n+1; i++)
		cout << (a[i] + bb[n-1])%c << " ";
	for(int i=m-n+1; i<m; i++)
		cout << (a[i] + bb[2*n+i-1-m])%c << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	vector<int> bb;
	bb.resize(2*n-1);
	bb[0] = b[0]%c;
	for(int i=1; i<n; i++)
	{
		bb[i] = (bb[i-1] + b[i])%c;
	}

	for(int i=0; i<n-1; i++)
	{
		bb[n+i] = (bb[n+i-1] - b[i])%c;
		if(bb[n+i] < 0)
			bb[n+i] += c;
	}

	for(int i=0; i<2*n-1; i++)
		bb[i] %= c;
	for(int i=0; i<n-1; i++)
		cout << (a[i] + bb[i])%c << " ";
	for(int i=n-1; i<m-n+1; i++)
		cout << (a[i] + bb[n-1])%c << " ";
	for(int i=m-n+1; i<m; i++)
		cout << (a[i] + bb[2*n+i-1-m])%c << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int m, n;
	int c;
	cin >> m >> n >> c;
	vector<int> a;
	a.resize(m);
	vector<int> b;
	b.resize(n);
	for(int i=0; i<m; i++)
		cin >> a[i];
	for(int i=0; i<n; i++)
		cin >> b[i];

	vector<int> bb;
	bb.resize(2*n-1);
	bb[0] = b[0]%c;
	for(int i=1; i<n; i++)
	{
		bb[i] = (bb[i-1] + b[i])%c;
	}

	for(int i=0; i<n-1; i++)
	{
		bb[n+i] = (bb[n+i-1] - b[i])%c;
		if(bb[n+i] < 0)
			bb[n+i] += c;
	}

	for(int i=0; i<2*n-1; i++)
		bb[i] %= c;
	if(2*n-m<3)
	{
		int i;
		for(i=0; i<n-1; i++)
			cout << (a[i] + bb[i])%c << " ";
		for(; i<m-n+1; i++)
			cout << (a[i] + bb[n-1])%c << " ";
		for(; i<m; i++)
			cout << (a[i] + bb[2*n+i-1-m])%c << " ";
		cout << endl;
	}
	else
	{
		for(int i=0; i<m-n+1; i++)
		{
			for(int j=0; j<n; j++)
				a[i+j] = (a[i+j]+b[j])%c;
		}
		for(int i=0; i<m; i++)
			cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn];
int sum[maxn];
int main()
{
	int n,m,c,i,j,k;
	while(scanf("%d%d%d",&n,&m,&c)!=EOF)
	{
		for(i=1;i<=n;i++) scanf("%d",&a[i]);
		memset(sum,0,sizeof(sum));
		for(j=1;j<=m;j++)
		{
			scanf("%d",&b[j]);
			sum[j]=sum[j-1]+b[j];
		}
		for(i=1;i<=min(n-m+1,m);i++)
		{
			//printf("sum[%d]=%d\n",i,sum[i]);
			a[i]=(a[i]+sum[i])%c;
			//printf("sum[%d]=%d\n",i,a[i]);
		}
		for(i=m+1;i<=n-m+1;i++)
		{
			//printf("gfgs");
			a[i]=(a[i]+sum[m])%c;
		}
		if(n-m+1>=m)
		{
			for(j=n-m+2,k=1;j<=n;j++,k++)
			{
				//printf("j=%d\n",j);
				a[j]=(a[j]+sum[m]-b[k])%c;
			}
		}
		else
		{
			//printf("i=%d\n",i);
			for(j=m+1,k=1;j<=n;j++,k++)
			{
				///printf("j=%d k=%d\n",j,k);
				//printf("j=%d\n",j);
				if(j==n)
				{
					a[j]=(a[j]+sum[m])%c;
				}else a[j]=(sum[j]-sum[k]+a[j])%c;
			}
		}
		printf("%d",a[1]);
		for(i=2;i<=n;i++) printf(" %d",a[i]);
		puts("");
	}
}


#include<cstdio>
#include<cstring>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn];
int sum[maxn];
int main()
{
	int n,m,c,i,j,k;
	while(scanf("%d%d%d",&n,&m,&c)!=EOF)
	{
		for(i=1;i<=n;i++) scanf("%d",&a[i]);
		memset(sum,0,sizeof(sum));
		for(j=1;j<=m;j++)
		{
			scanf("%d",&b[j]);
			sum[j]=sum[j-1]+b[j];
		}
		for(i=1;i<=min(n-m+1,m);i++)
		{
			//printf("sum[%d]=%d\n",i,sum[i]);
			a[i]=(a[i]+sum[i])%c;
		}
		for(i=min(n-m+1,m)+1;i<=n-m+1;i++)
		{
			//printf("gfgs");
			a[i]=(a[i]+sum[m])%c;
		}
		if(n-m+1>=m)
		{
			for(j=i,k=1;j<=n;j++,k++)
			{
				a[j]=(a[j]+sum[m]-b[k])%c;
			}
		}
		else
		{
			//printf("i=%d\n",i);
			for(j=i,k=1;j<=n;j++,k++)
			{
				///printf("j=%d k=%d\n",j,k);

				if(j==n)
				{
					a[j]=(a[j]+sum[m])%c;
				}else a[j]=(sum[j]-sum[k]+a[j])%c;
			}
		}
		printf("%d",a[1]);
		for(i=2;i<=n;i++) printf(" %d",a[i]);
		puts("");
	}
}


#include<cstdio>
#include<cstring>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn];
int sum[maxn];
int main()
{
	int n,m,c,i,j,k;
	while(scanf("%d%d%d",&n,&m,&c)!=EOF)
	{
		for(i=1;i<=n;i++) scanf("%d",&a[i]);
		memset(sum,0,sizeof(sum));
		for(j=1;j<=m;j++)
		{
			scanf("%d",&b[j]);
			sum[j]=sum[j-1]+b[j];
		}
		for(i=1;i<=min(n-m+1,m);i++)
		{
			//printf("sum[%d]=%d\n",i,sum[i]);
			a[i]=(a[i]+sum[i])%c;
			//printf("sum[%d]=%d\n",i,a[i]);
		}
		for(i=m+1;i<=n-m+1;i++)
		{
			//printf("gfgs");
			a[i]=(a[i]+sum[m])%c;
		}
		if(n-m+1>=m)
		{
			for(j=n-m+2,k=1;j<=n;j++,k++)
			{
				//printf("j=%d\n",j);
				a[j]=(a[j]+sum[m]-b[k])%c;
			}
		}
		else
		{
			//printf("i=%d\n",i);
			for(j=n-m+2,k=1;j<=n;j++,k++)
			{
				//printf("j=%d k=%d\n",j,k);
				//printf("j=%d\n",j);
				if(j==n)
				{
					a[j]=(a[j]+b[m])%c;
				}
				else a[j]=(sum[j]-sum[k]+a[j])%c;
			}
		}
		printf("%d",a[1]);
		for(i=2;i<=n;i++) printf(" %d",a[i]);
		puts("");
	}
}
/*
5 4 5
1 2 3 4 5
 1 2 3 4
 */


#include<cstdio>
#include<cstring>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn];
int sum[maxn];
int main()
{
    int n,m,c,i,j,k;
    while(scanf("%d%d%d",&n,&m,&c)!=EOF)
    {
        for(i=1;i<=n;i++) scanf("%d",&a[i]);
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
        {
            scanf("%d",&b[j]);
            sum[j]=sum[j-1]+b[j];
        }
        for(i=1;i<=min(n-m+1,m);i++)
        {
            //printf("sum[%d]=%d\n",i,sum[i]);
            a[i]=(a[i]+sum[i])%c;
            //printf("sum[%d]=%d\n",i,a[i]);
        }
        for(i=m+1;i<=n-m+1;i++)
        {
            //printf("gfgs");
            a[i]=(a[i]+sum[m])%c;
        }
        if(n-m+1>=m)
        {
            for(j=n-m+2,k=1;j<=n;j++,k++)
            {
                //printf("j=%d\n",j);
                a[j]=(a[j]+sum[m]-sum[k])%c;
            }
        }
        else
        {
            //printf("i=%d\n",i);
            for(j=n-m+2,k=1;j<=n;j++,k++)
            {
                //printf("j=%d k=%d\n",j,k);
                //printf("j=%d\n",j);
                if(j==n)
                {
                    a[j]=(a[j]+b[m])%c;
                }
                else a[j]=(sum[j]-sum[k]+a[j])%c;
            }
        }
        printf("%d",a[1]);
        for(i=2;i<=n;i++) printf(" %d",a[i]);
        puts("");
    }
}
/*
5 4 5
1 2 3 4 5
 1 2 3 4
 */


#include<cstdio>
#include<cstring>
#include<set>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn],b[maxn];
int sum[maxn];
int main()
{
    int n,m,c,i,j,k;
    while(scanf("%d%d%d",&n,&m,&c)!=EOF)
    {
        for(i=1;i<=n;i++) scanf("%d",&a[i]);
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
        {
            scanf("%d",&b[j]);
            sum[j]=sum[j-1]+b[j];
        }
        for(i=1;i<=min(n-m+1,m);i++)
        {
            //printf("sum[%d]=%d\n",i,sum[i]);
            a[i]=(a[i]+sum[i])%c;
            //printf("sum[%d]=%d\n",i,a[i]);
        }
        for(i=m+1;i<=n-m+1;i++)
        {
            //printf("gfgs");
            a[i]=(a[i]+sum[m])%c;
        }
        if(n-m+1>=m)
        {
            for(j=n-m+2,k=1;j<=n;j++,k++)
            {
                //printf("j=%d\n",j);
                a[j]=(a[j]+sum[m]-sum[k])%c;
            }
        }
        else
        {
            //printf("i=%d\n",i);
            for(j=n-m+2,k=1;j<=n;j++,k++)
            {
                //printf("j=%d k=%d\n",j,k);
                //printf("j=%d\n",j);
                if(j==n)
                {
                    a[j]=(a[j]+b[m])%c;
                }
                else
                    {
                        if(j>m) a[j]=(sum[m]-sum[k]+a[j])%c;
                        else a[j]=(sum[j]-sum[k]+a[j])%c;
                }
            }
        }
        printf("%d",a[1]);
        for(i=2;i<=n;i++) printf(" %d",a[i]);
        puts("");
    }
}
/*
5 4 5
1 2 3 4 5
 1 2 3 4
 */


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int NN=111111;
int fn[NN],fm[NN],sum[NN];
int main(){
#ifndef ONLINE_JUDGE
	freopen("/home/rainto96/in.txt","r",stdin);
#endif

	int n,m,c;cin>>n>>m>>c;
	for(int i=1;i<=n;i++) cin>>fn[i];
	for(int i=1;i<=m;i++){
		cin>>fm[i];
		sum[i]=(sum[i-1]+fm[i])%c;
	}
	int i;
	for(i=1;i<=n;i++){
                int r=min(m,i);
                int l=max(1,m+i-n);
                //cout<<"i::"<<i<<" l::"<<l<<" r::"<<r<<endl;
		fn[i]=(fn[i]+sum[r]-sum[l-1])%c;
		fn[i]<0?fn[i]+=c:fn[i]=fn[i];
	}
	for(int i=1;i<=n;i++) cout<<fn[i]<<' ';
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int NN=111111;
int fn[NN],fm[NN],sum[NN];
int main(){
#ifndef ONLINE_JUDGE
	freopen("/home/rainto96/in.txt","r",stdin);
#endif

	int n,m,c;cin>>n>>m>>c;
	for(int i=1;i<=n;i++) cin>>fn[i];
	for(int i=1;i<=m;i++){
		cin>>fm[i];
		sum[i]=(sum[i-1]+fm[i])%c;
	}
	int i;
	for(i=1;i<=n;i++){
                int r=min(m,i);
                int l=max(1,m+i-n);
                //cout<<"i::"<<i<<" l::"<<l<<" r::"<<r<<endl;
		fn[i]=(fn[i]+sum[r]-sum[l-1])%c;
	}
	for(int i=1;i<=n;i++) cout<<fn[i]<<' ';
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXN = 100100;

int A[MAXN];
int B[MAXN];
int prefs[MAXN];

int N, M, C;

int main() {
	scanf("%d %d %d", &N, &M, &C);
	for(int i = 0; i < N; ++i) {
		scanf("%d", A + i);
	}

	for(int i = 0; i < M; ++i) {
		scanf("%d", B + i);
	}

	for(int i = 0; i < M; ++i) {
		prefs[i + 1] = (prefs[i] + B[i]) % C;
	}

	for(int i = 0; i < N; ++i) {
		int high = min(M, i + 1);
		int low = max(0, i + M - N);
		int ans = (A[i] + prefs[high] - prefs[low]) % C;
		if (ans < 0) ans += C;

		if (i) printf(" ");
		printf("%d", ans);
	}

	printf("\n");
	return 0;
}


#include <cstdio>

using namespace std;

const int MAXN = 100100;

int A[MAXN];
int B[MAXN];
int prefs[MAXN];

int N, M, C;

int main() {
	scanf("%d %d %d", &N, &M, &C);
	for(int i = 0; i < N; ++i) {
		scanf("%d", A + i);
	}

	for(int i = 0; i < M; ++i) {
		scanf("%d", B + i);
	}

	for(int i = 0; i < M; ++i) {
		prefs[i + 1] = (prefs[i] + B[i]) % C;
	}

	for(int i = 0; i < N; ++i) {
		int high = i + 1;
		int free = N - i;
		if (high > M) {
			high = M;
		}
		int low = high - free;
		if (low < 0) low = 0;
		int ans = (A[i] + prefs[high] - prefs[low]) % C;
		if (ans < 0) ans += C;

		if (i) printf(" ");
		printf("%d", ans);
	}

	printf("\n");
	return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <set>
#include <stack>
#include <fstream>
#include <deque>
#include <queue>
#include <string.h>
using namespace std;

#define PI 3.14159265
typedef long long ll;
const int INF = (int)2e+9;
const int MAX_N = 2e5+7;

/*string convertInt(int number)
{
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}*/

int main(){
    int n, m, c; cin>>n>>m>>c;
    int nA[n], mA[m];
    for(int i = 0; i < n; i++)cin>>nA[i];
    for(int i = 0; i < m; i++)cin>>mA[i];
    for(int i = 0; i < n-m+1; i++)
        for(int j = 0; j < m; j++)
            nA[i+j] += mA[j];
    for(int i = 0; i < n; i++)
        cout<<nA[i]%c << " ";
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <set>
#include <stack>
#include <fstream>
#include <deque>
#include <queue>
#include <string.h>
using namespace std;

#define PI 3.14159265
typedef long long ll;
const int INF = (int)2e+9;
const int MAX_N = 2e5+7;

/*string convertInt(int number)
{
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}*/

int main(){
    int n, m, c; cin>>n>>m>>c;
    int nA[n], mA[m];
    for(int i = 0; i < n; i++)cin>>nA[i];
    for(int i = 0; i < m; i++)cin>>mA[i];
    int dp[m]; dp[0] = mA[0];
    for(int i = 1; i < m; i++)dp[i] = dp[i-1]+mA[i];
    for(int i = 0; i < n; i++)
        if(i < m) nA[i] += dp[i];
        else nA[i] += dp[m-1];
    for(int i = n-m+1; i < n; i++)
        nA[i] -= dp[i-(n-m+1)];
    for(int i = 0; i < n; i++)
        cout << nA[i]%c << " ";
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <set>
#include <stack>
#include <fstream>
#include <deque>
#include <queue>
#include <string.h>
using namespace std;

#define PI 3.14159265
typedef long long ll;
const int INF = (int)2e+9;
const int MAX_N = 2e5+7;

/*string convertInt(int number)
{
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}*/

int main(){
    int n, m, c; cin>>n>>m>>c;
    int nA[n], mA[m];
    for(int i = 0; i < n; i++)cin>>nA[i];
    for(int i = 0; i < m; i++)cin>>mA[i];
    int dp[m]; dp[0] = mA[0];
    for(int i = 1; i < m; i++)dp[i] = dp[i-1]+mA[i];
    for(int i = 0; i < n; i++)
        nA[i] += dp[i%m];
    for(int i = n-m+1; i < n; i++)
        nA[i] -= dp[i-(n-m+1)];
    for(int i = 0; i < n; i++)
        cout << nA[i]%c << " ";
    return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
#define fi "input.txt"
#define fa "output.txt"
#define foru(i,l,r) for(int i=l;i<r;i++)
#define ford(i,l,r) for(int i=l;i>r;i--)
#define re return
#define ll long long
#define mp make_pair

const int maxN=250000;
const int inf=1e17;
int n,m,c;
int a[maxN],kq[maxN],s[maxN],b[maxN];

void nhap() {
    scanf("%i %i %i\n",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%i\n",&a[i+1]);
    foru(i,0,m) scanf("%i",&b[i+1]);
}

void init() {
    foru(i,1,n+1) s[i]=(s[i-1]+b[i])%c;
}

void xuly() {
    int l=1,r=1;
    foru(i,1,n+1) {
        kq[i]=(a[i]+s[r]-s[l-1])%c;
        //printf("%i %i %i\n",i,l,r);
        if (i<m) ++r;
        if (n-i<m) ++l;
        printf("%i ",kq[i]);
    }
}

int main() {
    //freopen(fi,"r",stdin);
    //freopen(fa,"w",stdout);
    nhap();
    init();
    xuly();
    fclose(stdin);
    fclose(stdout);
    re 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
#define fi "input.txt"
#define fa "output.txt"
#define foru(i,l,r) for(int i=l;i<r;i++)
#define ford(i,l,r) for(int i=l;i>r;i--)
#define re return
#define ll long long
#define mp make_pair

const int maxN=250000;
const int inf=1e17;
int n,m,c;
int a[maxN],kq[maxN],s[maxN],b[maxN];

void nhap() {
    scanf("%i %i %i\n",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%i\n",&a[i+1]);
    foru(i,0,m) scanf("%i",&b[i+1]);
}

void init() {
    foru(i,1,n+1) s[i]=(s[i-1]+b[i])%c;
}

void xuly() {
    int l=1,r=1;
    foru(i,1,n+1) {
        kq[i]=(a[i]+s[r]-s[l-1]+c)%c;
        //printf("%i %i %i\n",i,l,r);
        if (i<m) ++r;
        if (n-i<m) ++l;
        printf("%i ",kq[i]);
    }
}

int main() {
//    freopen(fi,"r",stdin);
    //freopen(fa,"w",stdout);
    nhap();
    init();
    xuly();
//    fclose(stdin);
    //fclose(stdout);
    re 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
#define fi "input.txt"
#define fa "output.txt"
#define foru(i,l,r) for(int i=l;i<r;i++)
#define ford(i,l,r) for(int i=l;i>r;i--)
#define re return
#define ll long long
#define mp make_pair

const int maxN=250000;
const int inf=1e17;
int n,m,c;
int a[maxN],kq[maxN],s[maxN],b[maxN];

void nhap() {
    scanf("%i %i %i\n",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%i\n",&a[i+1]);
    foru(i,0,m) scanf("%i",&b[i+1]);
}

void init() {
    foru(i,1,n+1) s[i]=(s[i-1]+b[i])%c;
}

void xuly() {
    int l=1,r=1;
    foru(i,1,n+1) {
        kq[i]=(a[i]+s[r]-s[l-1])%c;
        //printf("%i %i %i\n",i,l,r);
        if (i<m) ++r;
        if (n-i<m) ++l;
        printf("%i ",kq[i]);
    }
}

int main() {
    freopen(fi,"r",stdin);
    freopen(fa,"w",stdout);
    nhap();
    init();
    xuly();
    fclose(stdin);
    fclose(stdout);
    re 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#define PB push_back
#define MP make_pair
#define PA pair
#define SC second
#define FS first
#define FOR(i,p,k) for(int i = (p) ;i<(k);i++)
using namespace std;

typedef long long int LL;

int n,m,c;
int MM=1;
int tab[1000007];
int war1[1000007],war2[1000007];

void insert(int a,int b,int w)
{
    int wa=a+MM;
    int wb=b+MM;

    tab[wa]+=w;
    if(wa!=wb)
        tab[wb]+=w;
    while(wa/2!=wb/2)
    {
        if(wa%2==0)
            tab[wa+1]+=w;
        if(wb%2==1)
            tab[wb-1]+=w;
        wa/=2;wb/=2;
    }
}

int pyt(int a)
{
    int w=0;
    int wa=a+MM;
    while(wa!=0)
    {
        w+=tab[wa];
        wa/=2;
    }
    return w;
}

void dane()
{
    scanf("%d %d %d",&n,&m,&c);
    FOR(i,0,n)
        scanf("%d",&war1[i]);
    FOR(i,0,m)
        scanf("%d",&war2[i]);
    while(MM<n)
        MM*=2;
    FOR(i,MM,MM+n)
        tab[i]=war1[i-MM];

    for(int i = 0 ; i <m;i++)
        insert(i,i+n-m,war2[i]);

    FOR(i,0,n)
        cout<<pyt(i)%c<<" ";
    cout<<"\n";
}

int main()
{
    dane();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#define PB push_back
#define MP make_pair
#define PA pair
#define SC second
#define FS first
#define FOR(i,p,k) for(int i = (p) ;i<(k);i++)
using namespace std;

typedef long long int LL;

int n,m,c;
int MM=1;
int tab[1000007];
int war1[1000007],war2[1000007];

void insert(int a,int b,int w)
{
    int wa=a+MM;
    int wb=b+MM;

    tab[wa]+=w;
    if(wa!=wb)
        tab[wb]+=w;
    while(wa/2!=wb/2)
    {
        if(wa%2==0)
            tab[wa+1]+=w;
        if(wb%2==1)
            tab[wb-1]+=w;
        wa/=2;wb/=2;
    }
}

int pyt(int a)
{
    int w=0;
    int wa=a+MM;
    while(wa!=0)
    {
        w+=tab[wa];
        wa/=2;
    }
    return w;
}

void dane()
{
    scanf("%d %d %d",&n,&m,&c);
    FOR(i,0,n)
        scanf("%d",&war1[i]);
    FOR(i,0,m)
        scanf("%d",&war2[i]);
    while(MM<n)
        MM*=2;
    FOR(i,MM,MM+n)
        tab[i]=war1[i-MM];

    for(int i = 0 ; i <n-m+1;i++)
        insert(i,i+n-m+1,war2[i]);

    FOR(i,0,n)
        cout<<pyt(i)%c<<" ";
    cout<<"\n";
}

int main()
{
    dane();
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c, summ = 0;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	if (m <= n - m + 1){
		for (int i = 0; i < n; i++){
			if ((i < m) && (i < n - m + 1)){
				summ += secondMass[i];
				firstMass[i] += summ;
			}
			else if (i < n - m + 1){
				firstMass[i] += summ;
			}

			else{
				summ -= secondMass[i - (n - m + 1)];
				firstMass[i] += summ;
			}
		}
	}
	else{
		for (int i = 0; i < n - m + 1; i++){
			summ += secondMass[i];
			firstMass[i] += summ;
		}
		for (int i = n - m + 1; i < m; i++){
			summ += secondMass[i];
		}
		for (int i = n - m + 1; i < n; i++){
			summ -= secondMass[i - (n - m + 1)];
			firstMass[i] += summ;
		}

	}
	for (int i = 0; i < n; i++)
		cout << firstMass[i] % c <<" ";

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	for (int i = 0; i < n - m + 1; i++){
		for (int j = 0; j < m; j++){
			firstMass[i + j] = (firstMass[i + j] + secondMass[j]) % c;
		}
	}

	for (int i = 0; i < n; i++)
		cout << firstMass[i] <<" ";

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c, summ = 0;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	if (m <= n - m + 1){
		for (int i = 0; i < n; i++){
			if (i < m){
				summ += secondMass[i];
				firstMass[i] += summ;
			}
			else if (i < n - m + 1){
				firstMass[i] += summ;
			}

			else{
				summ -= secondMass[i - (n - m + 1)];
				firstMass[i] += summ;
			}
		}
	}
	else{
		for (int i = 0; i < n - m + 1; i++){
			summ += secondMass[i];
			firstMass[i] += summ;
		}
		int k = 0;
		for (int i = n - m + 1; i < m; i++){
			summ = summ - secondMass[k] +  secondMass[i];
			firstMass[i] += summ;
			k++;
		}
		int q = 2*m - n - 1;
		for (int i = m; i < n; i++){
			summ -= secondMass[q];
			firstMass[i] += summ;
			q++;
		}

	}
	for (int i = 0; i < n; i++)
		cout << firstMass[i] % c <<" ";

	int s;
	cin >> s;
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c, summ = 0;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	for (int i = 0; i < n; i++){
		if (i < m){
			summ += secondMass[i];
			firstMass[i] += summ;
		}
		else if (i < n - m + 1){
			firstMass[i] += summ;
		}

		else{
			summ -= secondMass[i - (n - m + 1)];
			firstMass[i] += summ;
		}
	}

	for (int i = 0; i < n; i++)
		cout << firstMass[i] % c <<" ";

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c, summ = 0;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	if (m <= n - m + 1){
		for (int i = 0; i < n; i++){
			if ((i < m) && (i < n - m + 1)){
				summ += secondMass[i];
				firstMass[i] += summ;
			}
			else if (i < n - m + 1){
				firstMass[i] += summ;
			}

			else{
				summ -= secondMass[i - (n - m + 1)];
				firstMass[i] += summ;
			}
		}
	}
	else{
		for (int i = 0; i < n - m + 1; i++){
			summ += secondMass[i];
			firstMass[i] += summ;
		}
		int k = 0;
		for (int i = n - m + 1; i < m; i++){
			if (n - m + 1 != 2)
				summ = summ - secondMass[k] + secondMass[k+1] + secondMass[i];
			else
				summ = summ - secondMass[k] +  secondMass[i];
			firstMass[i] += summ;
			k++;
		}
		int q = 2*m - n -1;
		for (int i = m; i < n; i++){
			summ -= secondMass[q];
			firstMass[i] += summ;
			q++;
		}

	}
	for (int i = 0; i < n; i++)
		cout << firstMass[i] % c <<" ";

	int s;
	cin >> s;
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main(){
	vector <int> firstMass, secondMass;
	int n, m, c;
	cin >> n >> m >> c;

	firstMass.resize(n);
	secondMass.resize(m);
	for (int i = 0; i < n; i++)
		cin >> firstMass[i];

	for (int i = 0; i < m; i++)
		cin >> secondMass[i];

	for (int i = 0; i < n - m + 1; i++){
		for (int j = 0; j < m; j++){
			firstMass[i + j] = (firstMass[i + j] + secondMass[j]);
		}
	}

	for (int i = 0; i < n; i++)
		cout << firstMass[i] % c <<" ";

	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
const int MAX=(int)1e5+5;
int a[MAX],b[MAX],n,m,c,ret[MAX];
int main()
{
	scanf("%d%d%d",&n,&m,&c);
	for (int i=1; i<=n; i++) scanf("%d",a+i);
	for (int i=1; i<=m; i++) {
		scanf("%d",b+i);
		b[i]=(b[i]+b[i-1])%c;
	}
	for (int i=1; i<=n; i++) {
		if (i<=n-m+1) ret[i]=(a[i]+(i>=m?b[m]:b[i]))%c;
		else ret[i]=(a[i]+b[(i>=m)?m:i]+(c-b[m-1-(n-i)]))%c;
		printf("%d ",ret[i]);
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair < int, int > pii;

const ll linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int N = 1e5 + 9;

ll n, m, c, mod, a[N], b[N], pre[N];

int main() {

	scanf("%lld %lld %lld", &n, &m, &c);

	mod = c;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &b[i]);
		pre[i] = pre[i-1] + b[i];
	}
	for (int i = 1; i <= n; i++) {
		a[i] = (a[i] + pre[max(1ll, min(m, (i + m) - n + 1))] - pre[max((i + m - 1) - n, 0ll)]) % mod;
		printf("%lld ", a[i]);
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair < int, int > pii;

const ll linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int N = 1e5 + 9;

ll n, m, c, mod, a[N], b[N], pre[N];

int main() {

	scanf("%lld %lld %lld", &n, &m, &c);

	mod = c;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &b[i]);
		pre[i] = pre[i-1] + b[i];
	}
	for (int i = 1; i <= n; i++) {
		a[i] = (a[i] + pre[min(m, i * 1ll)] - pre[max(i + m - 1 - n, 0ll)]) % mod;
		printf("%lld ", a[i]);
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair < int, int > pii;

const ll linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int N = 1e5 + 9;

ll n, m, c, mod, a[N], b[N], pre[N];

int main() {

	scanf("%lld %lld %lld", &n, &m, &c);

	mod = c;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &b[i]);
		pre[i] = pre[i-1] + b[i];
	}
	for (int i = 1; i <= n; i++) {
		a[i] = (a[i] + pre[max(min(m, i * 1ll), min(m, (i + m) - n + 1))] - pre[max((i + m - 1) - n, 0ll)]) % mod;
		printf("%lld ", a[i]);
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <string>
#define INF 2000000000
#define ii pair<int, int>
#define LL long long

using namespace std;

LL m,n,c,a[100005],b[100005],sum[100005];

int main() {

    while (scanf("%I64d %I64d %I64d",&n,&m,&c)!=EOF){
        memset(sum,0,sizeof(sum));
        for (LL i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sum[0]=0;
        for (LL i=1;i<=m;i++) {
            scanf("%d",&b[i]);
            if (i==1) sum[i]=b[i]; else
            sum[i]=(sum[i-1]+b[i]);
        }
        int pos=1;
        for (LL i=1;i<=n;i++) {
            if (i<=(n-m+1)) {
                if (i<=m) a[i]=(a[i]+sum[i])%c;
                else a[i]=(a[i]+sum[m])%c;
            } else {
                if (n%2LL>0LL) {
                    a[i]=(a[i]+sum[m]-sum[(pos)])%c;
                } else {
                    a[i]=(a[i]+sum[m]-sum[(pos)])%c;
                }
                pos++;
            }
        }
        for (int i=1;i<=n;i++) {
            if (i==1) printf("%I64d",a[i]);
            else printf(" %I64d",a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <string>
#define INF 2000000000
#define ii pair<int, int>
#define LL long long

using namespace std;

LL m,n,c,a[100005],b[100005],sum[100005];

int main() {

    while (scanf("%I64d %I64d %I64d",&n,&m,&c)!=EOF){
        memset(sum,0,sizeof(sum));
        for (LL i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sum[0]=0;
        for (LL i=1;i<=m;i++) {
            scanf("%d",&b[i]);
            if (i==1) sum[i]=b[i]; else
            sum[i]=(sum[i-1]+b[i])%(c*c);
        }
        int pos=1;
        for (LL i=1;i<=n;i++) {
            if (i<=(n-m+1)) {
                if (i<=m) a[i]=(a[i]+sum[i])%c;
                else a[i]=(a[i]+sum[m])%c;
            } else {
                if (n%2LL>0LL) {
                    a[i]=(a[i]+sum[m]-sum[(pos)])%c;
                } else {
                    a[i]=(a[i]+sum[m]-sum[(pos)])%c;
                }
                pos++;
            }
        }
        for (int i=1;i<=n;i++) {
            if (i==1) printf("%I64d",a[i]);
            else printf(" %I64d",a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <string>
#define INF 2000000000
#define ii pair<int, int>
#define LL long long

using namespace std;

int m,n,c,a[100005],b[100005],sum[100005];

int main() {

    while (scanf("%d %d %d",&n,&m,&c)!=EOF){
        memset(sum,0,sizeof(sum));
        for (int i=1;i<=n;i++) {
            scanf("%d",&a[i]);
        }
        sum[0]=0;
        for (int i=1;i<=m;i++) {
            scanf("%d",&b[i]);
            if (i==1) sum[i]=b[i]; else
            sum[i]=(sum[i-1]+b[i]);
        }
        int x=0, y=0;
        for (int i=1;i<=n;i++) {
            if (i<=(n-m)+1) {
                x=1;
                y=min(y+1,m);
            } else {
                x++;
                y=min(y+1,m);
            }
            a[i]=(a[i]+sum[y]-sum[x-1])%c;
        }
        for (int i=1;i<=n;i++) {
            if (i==1) printf("%d",a[i]);
            else printf(" %d",a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <string>
#define INF 2000000000
#define ii pair<int, int>
#define LL long long

using namespace std;

LL m,n,c,a[100005],b[100005];

int main() {

	while (scanf("%I64d %I64d %I64d",&n,&m,&c)!=EOF){
		for (LL i=0;i<n;i++) {
			scanf("%d",&a[i]);
		}
		for (LL i=0;i<m;i++) {
			scanf("%d",&b[i]);
		}
		for (int i=0;i<n-m+1;i++) {
			for (int j=0;j<m;j++) {
				a[i+j]=(a[i+j]+b[j])%c;
			}
		}
		for (int i=0;i<n;i++) {
			if (i==0) printf("%I64d",a[i]);
			else printf(" %I64d",a[i]);
		}
		printf("\n");
	}
    return 0;
}


#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <string>
#include <time.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
vector < int > a,b;
int main ()
{
    int c,d,i,j,n,m,mod;
    cin>>n>>m>>mod;
    a.resize(n);b.resize(m);
    for (i=0;i<n;i++)
        cin>>a[i];
    for (i=0;i<m;i++)
    {
        cin>>b[i];
        for (j=i;j<=i+(n-m);j++)
            a[j]+=b[i];
    }
    cout<<a[0]%mod;
    for (i=1;i<n;i++)
        cout<<" "<<a[i]%mod;
    cout<<endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <string>
#include <time.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
vector < long long > a,b;
int main ()
{
    int i,j,n,m,mod,s=0,t=0;
    cin>>n>>m>>mod;
    a.resize(n);b.resize(m);
    for (i=0;i<n;i++)
        cin>>a[i];
    for (i=0;i<m;i++)
    {
        cin>>b[i];
    }
    int x=0,y=-1;
    for (i=0;i<n;i++)
    {
        if (i > n-m)
        {
            s-=b[x];
            x++;
        }
        if (y<m-1)
        {
            y++;
            s+=b[y];
        }
            a[i]=(a[i]+s)%mod;
    }
    cout<<a[0];
    for (i=1;i<n;i++)cout<<" "<<a[i];
    cout<<endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <string>
#include <time.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
vector < long long > a,b;
int main ()
{
    int i,j,n,m,mod,sum[2000]={0};
    cin>>n>>m>>mod;
    a.resize(n);b.resize(m);
    for (i=0;i<n;i++)
        cin>>a[i];
    for (i=0;i<m;i++)
    {
        cin>>b[i];
        if (i>0)sum[i]=sum[i-1]+b[i];
        else sum[i]=b[i];
    }
    cout<<(a[0]+sum[0])%mod;
    for (i=1;i<n;i++)
    {
        if (i+m <= n)
            cout<<" "<<(a[i]+sum[min(i,m-1)])%mod;
        else
            cout<<" "<<(a[i]+(sum[m-1]-sum[(i+m)-n-1]))%mod;
    }
    cout<<endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <string>
#include <time.h>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
vector < int > a,b;
int main ()
{
    int c,d,i,j,n,m,mod;
    cin>>n>>m>>mod;
    a.resize(n);b.resize(m);
    for (i=0;i<n;i++)
        cin>>a[i];
    for (i=0;i<m;i++)
        cin>>b[i];
    for (i=0;i<=n-m;i++)
        for (j=i;j<i+m;j++)
            a[j]=(a[j]+b[j-i])%mod;
    cout<<a[0];
    for (i=1;i<n;i++)
        cout<<" "<<a[i];
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
int a[N],b[N],n,m,c;
int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%d",a+i);
    for(int i=0;i<m;i++) {scanf("%d",b+i);if(i) b[i]+=b[i-1];}
    for(int i=0;i<n;i++)
    {
        int r=min(m-1,i),l=max(i-n+m,0);
        a[i]+=(b[r]-b[l-1])%c;
        cout<<(a[i]+c)%c<<" ";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
int a[N],b[N],b1[N],b2[N],n,m,c;
int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",b+i);
        b1[i]=(b[i]+b1[i-1])%c;
    }
    for(int i=m;i>=1;i--) b2[m-i+1]=(b[i]+b2[m-i])%c;
    for(int i=0;i<=n/2 && i<=n-i-1;i++)
    {
        int idx=(i+1>m)?m:i+1;
        a[i]=(a[i]+b1[idx])%c;
        if(i!=n-i-1)a[n-i-1]=(a[n-i-1]+b1[m]-b1[m-idx])%c;
    }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


#include <iostream>
#include <cstdio>
#define N 100010
using namespace std;
int a[N],b[N],n,m,c;
int main()
{
    cin>>n>>m>>c;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) {cin>>b[i];if(i) b[i]+=b[i-1];}
    for(int i=0;i<n;i++){
        int r=min(m-1,i),l=max(i-n+m,0);
        a[i]+=b[r]-b[l-1];
        cout<<a[i]%c<<" ";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
int a[N],b[N],b1[N],b2[N],n,m,c;
int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",b+i);
        b1[i]=(b[i]+b1[i-1])%c;
    }
    for(int i=m;i>=1;i--) b2[m-i+1]=(b[i]+b2[m-i])%c;
    for(int i=0;i<=n/2 && i<=n-i-1;i++)
    {
        int idx=(i+1>m)?m:i+1;
        a[i]=(a[i]+b1[idx])%c;
        if(i!=n-i-1)a[n-i-1]=(a[n-i-1]+b2[idx])%c;
    }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
int a[N],b[N],b1[N],b2[N],n,m,c;
int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(int i=0;i<n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++)
    {
        scanf("%d",b+i);
        b1[i]=b[i]+b1[i-1];
    }
    for(int i=m;i>=1;i--) b2[m-i+1]=b[i]+b2[m-i];
    for(int i=0;i<=n/2 && i<=n-i-1;i++)
    {
        int idx=(i+1>m)?m:i+1;
        a[i]=(a[i]+b1[idx])%c;
        if(i!=n-i-1)a[n-i-1]=(a[n-i-1]+b2[idx])%c;
    }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 100*1000 + 5;
int a[maxN], b[maxN], sum[maxN];

main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n, m, c; cin >> n >> m >> c;
	for(int i = 0; i < n; i ++)
		cin >> a[i];
	for(int i = 0; i < m; i ++)
		cin >> b[i], sum[i + 1] = sum[i] + b[i];

	for(int i = 0; i < n; i ++)
	{
		int lo, hi;
		if(i < m - 1) hi = i;
		else hi = m - 1;

		if(i < n - m) lo = 0;
		else lo = m + i - n;
		//cout << lo << ' ' << hi << endl;
		int tmp = sum[hi + 1] - sum[lo] + a[i]; tmp %= c; tmp += c; tmp %= c;
		cout << tmp << ' ';
	}
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define int long long

const int MaxN=1E5+10;
int a[MaxN],b[MaxN],sum[MaxN];

int32_t main(){
	int n,m,c;
	cin >> n >> m >> c;
	for(int i=0;i<n;++i)
		cin >> a[i];
	for(int i=0;i<m;++i){
		cin >> b[i];
		sum[i+1]=sum[i]+b[i];
	}
	for(int i=0;i<n;++i){
		int l,r;
		if(i<m-1)
			r=i;
		else
			r=m-1;
		if(i<n-m)
			l=0;
		else
			l=m+i-n;
		int ans=sum[r+1]-sum[l]+a[i];
		ans%=c;
		cout << ans << " ";
	}
}


#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN=1000*100+10;
int a[MAXN],b[MAXN],c,s[MAXN],ans[MAXN];
int n,m;
int main()
{
	cin >> n >> m >> c;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=m;i++)
		s[i]=(s[i-1]+b[i])%c;
	for(int i=1;i<=n;i++)
		ans[i]=a[i];
	for(int i=1;i<=n;i++)
	{
		if(i<=m)
		{
			if(i+m-1<=n)
			{
				ans[i]+=s[i];
				ans[i]%=c;
				continue;
			}
			else
			{
				ans[i]+=(s[i]-s[i-(n-m)-1])%c;
				ans[i]+=c;
				ans[i]%=c;
				continue;
			}
		}
		if(i+m-1<=n)
		{
			ans[i]+=s[m];
			ans[i]%=c;
			continue;
		}
		ans[i]+=(s[m]-s[i-m+n])%c;
		ans[i]+=c;
		ans[i]%=c;
	}
	for(int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN=1000*100+10;
int a[MAXN],b[MAXN],c,s[MAXN],ans[MAXN];
int n,m;
int main()
{
	cin >> n >> m >> c;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<m;i++)
		scanf("%d",&b[i]);
	s[0]=b[0];
	for(int i=1;i<m;i++)
		s[i]=(s[i-1]+b[i])%c;
	for(int i=0;i<n;i++)
		ans[i]=a[i];
	for(int i=0;i<n;i++)
	{
		if(i<m)
		{
			if(i+m-1<=n-1)
			{
				ans[i]+=s[i];
				ans[i]%=c;
				continue;
			}
			else
			{
				ans[i]+=(s[i]-s[i-(n-m)-1])%c;
				ans[i]+=c;
				ans[i]%=c;
				continue;
			}
		}
		if(i+m-1<n)
		{
			ans[i]+=s[m-1];
			ans[i]%=c;
			continue;
		}
		ans[i]+=(s[m-1]-s[m+n-i-1])%c;
		ans[i]+=c;
		ans[i]%=c;
	}
	for(int i=0;i<n;i++)
		printf("%d ",ans[i]);
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN=1000*100+10;
int a[MAXN],b[MAXN],c,s[MAXN],ans[MAXN];
int n,m;
int main()
{
	cin >> n >> m >> c;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<m;i++)
		scanf("%d",&b[i]);
	s[0]=b[0];
	for(int i=1;i<m;i++)
		s[i]=(s[i-1]+b[i])%c;
	for(int i=0;i<n;i++)
		ans[i]=a[i];
	for(int i=0;i<n;i++)
	{
		if(i<m)
		{
			if(i+m-1<=n-1)
			{
				ans[i]+=s[i];
				ans[i]%=c;
				continue;
			}
			else
			{
				ans[i]+=(s[i]-s[n-m+i-1])%c;
				ans[i]+=c;
				ans[i]%=c;
				continue;
			}
		}
		if(i+m-1<n)
		{
			ans[i]+=s[m-1];
			ans[i]%=c;
			continue;
		}
		ans[i]+=(s[m-1]-s[m+n-i-1])%c;
		ans[i]+=c;
		ans[i]%=c;
	}
	for(int i=0;i<n;i++)
		printf("%d ",ans[i]);
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN=1000*100+10;
int a[MAXN],b[MAXN],c,s[MAXN],ans[MAXN];
int n,m;
int main()
{
	cin >> n >> m >> c;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=m;i++)
		s[i]=(s[i-1]+b[i])%c;
	for(int i=1;i<=n;i++)
		ans[i]=a[i];
	for(int i=1;i<=n;i++)
	{
		if(i<=m)
		{
			if(i+m-1<=n)
			{
				ans[i]+=s[i];
				ans[i]%=c;
				continue;
			}
			else
			{
				ans[i]+=(s[i]-s[i-(n-m)-1])%c;
				ans[i]+=c;
				ans[i]%=c;
				continue;
			}
		}
		if(i+m-1<=n)
		{
			ans[i]+=s[m];
			ans[i]%=c;
			continue;
		}
//		cerr << m << " " << i-n+m-1 << endl;
		ans[i]+=(s[m]-s[i-n+m-1])%c;
		ans[i]+=c;
		ans[i]%=c;
	}
	for(int i=1;i<=n;i++)
		printf("%d ",ans[i]);
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN=1000*100+10;
int a[MAXN],b[MAXN],c,s[MAXN],ans[MAXN];
int n,m;
int main()
{
	cin >> n >> m >> c;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<m;i++)
		scanf("%d",&b[i]);
	s[0]=b[0];
	for(int i=1;i<=m;i++)
		s[i]=(s[i-1]+b[i])%c;
	for(int i=0;i<n;i++)
		ans[i]=a[i];
	for(int i=0;i<n;i++)
	{
		if(i<m)
		{
			if(i+m-1<n)
			{
				ans[i]+=s[i];
				ans[i]%=c;
				continue;
			}
			else
			{
				ans[i]+=(s[i]-s[i-m+1])%c;
				ans[i]+=c;
				ans[i]%=c;
				continue;
			}
		}
		if(i+m-1<n)
		{
			ans[i]+=s[m];
			ans[i]%=c;
			continue;
		}
		ans[i]+=(s[m]-s[m+n-i])%c;
		ans[i]+=c;
		ans[i]%=c;
	}
	for(int i=0;i<n;i++)
		printf("%d ",ans[i]);
	return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j, sm[MX];

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=m; i++ ) sm[i]=sm[i-1]+key[i];
    for (i=1; i<=n-m+1 ; i++)
       if (i<m)
        s[i]=(s[i]+sm[i] )%c;
        else s[i]= (s[i]+ sm[m] ) % c;

    for (j=i; j<=n; j++)
        s[j]= (s[j]+sm[m]-sm[j+m-n-1] ) % c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j, sm[MX];

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=m; i++ ) sm[i]=sm[i-1]+(key[i]%c);
    for (i=1; i<=n-m+1 ; i++)
       if (i<m)
        s[i]=(s[i]+sm[i] )%c;
        else s[i]= (s[i]+ sm[m] ) % c;

    for (j=i; j<=n; j++)
        if (j<m)
            s[j]= (s[j]+sm[i]-sm[j+m-n-1] ) % c;
        else s[j]= (s[j]+sm[m]-sm[j+m-n-1] ) % c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j, sm[MX];

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=m; i++ ) sm[i]=sm[i-1]+(key[i]%c);
    for (i=1; i<=n-m+1 ; i++)
       if (i<m)
        s[i]=(s[i]+sm[i] )%c;
        else s[i]= (s[i]+ sm[m] ) % c;

    for (j=i; j<=n; j++)
        s[j]= (s[j]+sm[m]-sm[j+m-n-1] ) % c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j, sm[MX];

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=m; i++ ) sm[i]=sm[i-1]+(key[i]%c);
    for (i=1; i<=n-m+1 ; i++)
       if (i<m)
        s[i]=(s[i]+sm[i] )%c;
        else s[i]= (s[i]+ sm[m] ) % c;

    for (j=i; j<=n; j++)
        if (j<m)
            s[j]= (s[j]+sm[j]-sm[j+m-n-1] ) % c;
        else s[j]= (s[j]+sm[m]-sm[j+m-n-1] ) % c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j, sm[MX];

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=m; i++ ) sm[i]=sm[i-1]+key[i];
    for (i=1; i<=n-m+1 ; i++)
       if (i<m)
        s[i]=(s[i]+sm[i] )%c;
        else s[i]= (s[i]+ sm[m] ) % c;

    for (j=i; j<=n; i++)
        s[j]= (s[j]+sm[m]-sm[j+m-n-1] ) % c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
using namespace std;
#define MX 100010
int s[MX], key[MX], n,m,c, i,j;

int main()
{   cin>>n>>m>>c;
    for (i=1; i<=n; i++) cin>>s[i];
    for (i=1; i<=m; i++) cin>>key[i];

    for (i=1; i<=n-m+1; i++)
        for (j=1; j<=m; j++ )
            s[j+i-1]=(s[j+i-1]+key[j])%c;

    for (i=1; i<=n; i++ ) cout<<s[i]<<" ";

    return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <ctime>

using namespace std;

const long long INF = 1e8;

#define debug cerr << "here" << "\n";
#define endl '\n'

int main() {
	ios_base::sync_with_stdio(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
#endif //LOCAL
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n), p(m + 1);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		p[i + 1] = p[i] + x;
	}
	for (int i = 0; i < n; i++) {
		a[i] += p[min(i + 1, m)] - p[min(max(i - (n - m), 0), m)];
		a[i] %= c;
	}
	for (int i = 0; i < n; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <ctime>

using namespace std;

const long long INF = 1e8;

#define debug cerr << "here" << "\n";
#define endl '\n'

int main() {
	ios_base::sync_with_stdio(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
#endif //LOCAL
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n), p(m + 1);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		p[i + 1] = p[i] + x;
	}
	for (int i = 0; i < n; i++) {
		cerr << p[min(i + 1, m)] << endl;
		cerr << i + 1 << " " << i - n + m << endl;
		cerr << min(i + 1, m) << " " << min(max(i - (n - m), 0), m) << endl;
		a[i] += p[min(i + 1, m)] - p[min(max(i - (n - m), 0), m)];
		a[i] %= c;
	}
	for (int i = 0; i < n; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<iostream>
#include<string>
#include<deque>
#include<list>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<set>
using namespace std;
#define ll long long
#define lowbit(x) (x&-x)
#define f first
#define s second
#define pr pair<int,int>
#define mk(x,y) make_pair(x,y)
#define eps 1e-8
#define pi acos(-1.0)
#define square(x) ((x)*(x))
#define getvec(x,y) ((y)-(x))
#define xmul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
#define inf 0x3f3f3f3f
#define mod ((ll)1e9+7)
#define maxn 100010

int n,m,c,a[maxn],b[maxn];
int lef[maxn],rig[maxn];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("G:\\ACM\\inandout\\in.txt","r",stdin);
//	freopen("G:\\ACM\\inandout\\out.txt","w",stdout);
#endif
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++) scanf("%d",b+i);
    for(int i=1;i<=m;i++) lef[i]=(lef[i-1]+b[i])%c;
    for(int i=m;i>0;i--) rig[i]=(rig[i+1]+b[i])%c;
    int i=1;
    for(;i*m<=n-m+1;i++) {
        for(int j=(i-1)*m+1;j<=i*m;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
        for(int j=(i+1)*m-1;j>i*m;j--) a[j]=(a[j]+rig[j-i*m+1])%c;
    }
    for(int j=(i-1)*m+1;j<=n-m+1;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
    for(int j=n;j>n-m+1;j--) a[j]=(a[j]+rig[j-(n-m)])%c;
    for(i=1;i<=n;i++) printf("%d ",a[i]);
    printf("\n");
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<iostream>
#include<string>
#include<deque>
#include<list>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<set>
using namespace std;
#define ll long long
#define lowbit(x) (x&-x)
#define f first
#define s second
#define pr pair<int,int>
#define mk(x,y) make_pair(x,y)
#define eps 1e-8
#define pi acos(-1.0)
#define square(x) ((x)*(x))
#define getvec(x,y) ((y)-(x))
#define xmul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
#define inf 0x3f3f3f3f
#define mod ((ll)1e9+7)
#define maxn 100010

int n,m,c,a[maxn],b[maxn];
int lef[maxn],rig[maxn];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("G:\\ACM\\inandout\\in.txt","r",stdin);
//	freopen("G:\\ACM\\inandout\\out.txt","w",stdout);
#endif
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++) scanf("%d",b+i);
    for(int i=1;i<=m;i++) lef[i]=(lef[i-1]+b[i])%c;
    for(int i=m;i>0;i--) rig[i]=(rig[i+1]+b[i])%c;
    int i=1;
    for(;i*m<n-m+1;i++) {
        for(int j=(i-1)*m+1;j<=i*m;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
        for(int j=(i+1)*m-1;j>i*m;j--) a[j]=(a[j]+rig[j-i*m+1])%c;
    }
    for(int j=(i-1)*m+1;j<=n-m+1;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
    for(int j=n;j>n-m+1;j--) a[j]=(a[j]+rig[j-(n-m)])%c;
    for(i=1;i<=n;i++) printf("%d ",a[i]);
    printf("\n");
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<iostream>
#include<string>
#include<deque>
#include<list>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<set>
using namespace std;
#define ll long long
#define lowbit(x) (x&-x)
#define f first
#define s second
#define pr pair<int,int>
#define mk(x,y) make_pair(x,y)
#define eps 1e-8
#define pi acos(-1.0)
#define square(x) ((x)*(x))
#define getvec(x,y) ((y)-(x))
#define xmul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
#define inf 0x3f3f3f3f
#define mod ((ll)1e9+7)
#define maxn 100010

int n,m,c,a[maxn],b[maxn],t;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("G:\\ACM\\inandout\\in.txt","r",stdin);
//	freopen("G:\\ACM\\inandout\\out.txt","w",stdout);
#endif
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++) scanf("%d",b+i);
    for(int i=1;i<=n;i++) {
        if(i<=m) t+=b[i];
        if(i>n-m+1) t-=b[i-(n-m+1)];
        a[i]=(a[i]+t)%c;
        printf("%d ",a[i]);
    } printf("\n");
	return 0;
}