#include <bits/stdc++.h>
#define a() for(int i=1;i<=n;i++)
using namespace std;
int n,X;
string s[1000];
int main()
{
  cin>>n;
  a()cin>>s[i];
  a()
  {
    if(s[i]=="++X")++X;
    else if(s[i]=="X++")X++;
    else if(s[i]=="--X")--X;
    else if(s[i]=="X--")X--;
  }
  cout<<X;
  return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
long long a,ans;
string S;
int main()
{
 cin>>a;
 for(int i=0;i<a;i++)
 {
  cin>>S;
  if(S[1]=='+')ans++;
  else ans--;
 }
 cout<<ans<<endl;
 return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[150],ans;
char s[10];
bool cmp(int a,int b){
	return a>b;
}
int main(){
	int n;
	scanf("%d",&n);

	for(int i=1;i<=n;i++){
		cin>>s;
		for(int j=0;j<=2;j++){
			if(s[j]=='+'){
				ans++;
				break;
			}
			if(s[j]=='-'){
				ans--;
				break;
			}
		}
	}
	printf("%d",ans);
	return 0;
	}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x=0;
	string a;
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a;
		if (a=="X++"||a=="++X") x++;
		else x--;
	}
	cout<<x;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s[1005];
int n;
int cnt;
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>s[i];
	for(int i=1;i<=n;++i)
		if(s[i]=='X++'||s[i]=='++X')
			cnt++;
		if(s[i]=='X--'||s[i]=='--X')
			cnt--;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
long long a,ans;
string S;
int main()
{
 cin>>a;
 for(int i=0;i<a;i++)
 {
  cin>>S;
  if(S[1]=='+')ans++;
  else ans--;
 }
 cout<<ans<<endl;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
string s;
int n,x;
int main(){
    scanf("%d",&n),x=0;
    while(n--){
        scanf("%s",s);
        if(s=="X++" || s=="++X") x++;
        else x--;
    }
    printf("%d",x);
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b=0;
    cin>>a;
    char b[a];
    for(int i=0;i<a;i++)
    {
        scanf("%s",&b[i]);
    }
    for(int i=0;i<a;i++)
    {
        if(b[i]==x++ || ++x)
        {
            b++;
        }
        else
        {
            b--;
        }
    }
    printf("%d",b);
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
string S;
int main()
{
    long long a,X;
    scanf("%ld",&a);
    for(int i=0;i<a;i++)
    {
        cin>>S;
        if(S[1]=='+')
            X++;
        else
            X--;
    }
    printf("%ld\n",X);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
string s;
int n,ans=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s;
		if(s[1]=='+')ans++;
		else ans--;
	}
	cout<<ans<<endl;
	return 0;
}


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

string b,a[]={"++X","X++","--X","X--"};

int main()
{
	int n,x=0;cin>>n;
	while (n--)
	{
		cin>>b;
		for(int i=0;i<4;i++)
			if(b==a[i])
			{
				if(i<2) x++;
				else x--;
				break;
			}
	}
	cout<<x<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b=0;
    cin>>a;
    char c[a];
    for(int i=0;i<a;i++)
    {
        scanf("%s",&c[i]);
    }
    for(int i=0;i<a;i++)
    {
        if(c[i]==x++ || ++x)
        {
            b++;
        }
        else
        {
            b--;
        }
    }
    printf("%d",b);
    return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;
long long a,ans;
string s;
int main()
{
  scanf("%lld",&a);
  for(int i=0;i<a;i++)
  {
    cin>>s;
    if(s[1]=='+')  ans++;
    else ans--;
  }
  printf("%lld",ans);
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 1;
int a[MAX_N], b_pr[MAX_N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, c;
    cin >> n >> m >> c;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    b_pr[0] = 0;
    for (int i = 1; i <= m; ++i) {
        int val;
        cin >> val;
        b_pr[i] = (b_pr[i - 1] + val) % c;
    }
    for (int i = 1; i <= n; ++i) {
        int mn_added = max(1, m - (n - i));
        int mx_added = min(m, i);
        a[i] = (a[i] + b_pr[mx_added] - b_pr[mn_added - 1] + c) % c;
        cout << a[i] << ' ';
    }
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main() {
    int n,m,d;
    cin>>n>>m>>d;
    int a[n],b[m];

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        //cout<<a[i]<<" ";
    }

    int x=0;

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

}


#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    FAST;
    int n,m,d;
    cin>>n>>m>>d;
    int a[n],b[m],sum[m],sum2[m];

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        //cout<<a[i]<<" ";
    }

    int x=0;

    for(int i=0;i<m;i++)
    {
        cin>>b[i];
        x=x+b[i];
        sum[i]=x;

    }
    int tot=sum[m-1];
    x=0;
    int j;
    for(int i=m-1,j=0;i>=0;i--,j++)
    {
        x=x+b[i];
        //cout<<x<<" ";
        sum2[j]=x;
    }
    int i=0;
    j=n-1;
    while(i<j)
    {
        if(i<m)
        {
            a[i]=a[i]+sum[i];
            cout<<a[i]%d<<" ";
        }
        else
        {
            a[i]=a[i]+sum[m-1];
            cout<<a[i]%d<<" ";
        }
        i++;
        j--;
    }
    if(n%2!=0)
    {
        if(n/2 +1 >=m)
        {
            cout<<(a[n/2]+sum[m-1])%d<<" ";
        }
        else
        {
            cout<<(a[n/2]+sum[m-1]-b[0]-b[m-1])%d<<" ";
        }
    }
    j=n-1;
    i=0;
    while(i<j)
    {
        if(i<m)
        {
            a[j]=a[j]+sum2[i];
           // cout<<a[j]<<" ";
        }
        else
        {
            a[j]=a[j]+sum[m-1];
           // cout<<a[j]<<" ";
        }
        i++;
        j--;
    }
    for(int k=j+1;k<n;k++)
    {
        cout<<a[k]%d<<" ";
    }
   return 0;

}


#include<bits/stdc++.h>
using namespace std;
/*
 __     __  _________  ____      ____ _____________
|  |   |  |/   ___   \|    |    |    |____     ____|
|  |___|  /   |___|   |    |    |    |    |   |
|   ___   |    ___    |    |    |    |    |   |
|  |   |  |   |   |   |    |____|    |    |   |
|__|   |__|___|   |___|_________|____|    |___|
*/

#define fr(x) freopen(x,"r",stdin);
#define fw(x) freopen(x,"w",stdout);
#define ft() front();
#define heap priority_queue
#define all(x) begin(x), end(x)
#define mst(x,a) memset(x,a,sizeof(x));
#define INF (lo)(1e9 + 7)
#define MOD (lo)(1e9 + 7)
#define mp make_pair
#define pb push_back
#define pp pop_back
#define st first
#define nd second
#define ln "\n"
#define null NULL
#define MAXN 100005
#define input(x) getline(cin,x);
#define FIO() {ios_base::sync_with_stdio(0);cin.tie(null);cout.tie(null);}
typedef long long int lo;
typedef pair<lo,lo> pii;

template <typename T>
void debug(T x,string str){
    #ifndef ONLINE_JUDGE
        cout << str << " " << x << ln;
    #endif
}
template <typename T>
void debug(T x){
    #ifndef ONLINE_JUDGE
        cout << x << ln;
    #endif
}
template <typename T>
void debug(T x,lo l,lo r){
    #ifndef ONLINE_JUDGE
        for(lo i = l;i <= r;i++)
            cout << x[i] << " ";
    #endif
}
lo n,m,c;
lo arr[1000006];
lo err[1000006];

int main(){
    FIO()
    cin >> n >> m >> c;
    for(lo i = 1;i <= n;i++) cin >> arr[i];
    for(lo i = 1;i <= m;i++) cin >> err[i];

    for(lo i = 1;i <= n-m+1;i++) for(lo j = 1;j <= m;j++) arr[j+i-1] = (err[j]+arr[j+i-1])%c;
    for(lo i = 1;i <= n;i++) cout << arr[i] << " ";
}


#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

#define REP(i,a,b) for (ll i = a; i <= b; i++)
#define ALL(a)              a.begin(), a.end()
#define ALLN(a, n)          (a, a+n)
#define MAX                 10000007
#define MIN                 -10000007

int main()
{
  ios::sync_with_stdio(0);
    cin.tie(0);
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif

    int t;
    t=1;
     //  cin>>t;
    while(t--){
            ll m,n,c;
            cin>>n>>m>>c;
            ll steps=n-m+1;
            ll a[n+1],b[n+1]={0},preA[n+1]={0},preB[n+1]={0};
            REP(i,0,n-1){
              cin>>a[i];
              //preA[i]=preA[i-1]+a[i];
            }
            REP(i,0,m-1){
              cin>>b[i];
              preB[i+1]=preB[i]+b[i];
            }

            REP(i,0,n-1){
              ll r=min(m-1,i);
              ll l=max(0ll,i-n+m);
              cout<<(a[i]+((preB[r+1]-preB[l])%c+c)%c)%c<<" ";
            }
            //cout<<a[i]<<" ";

             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main()
{
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);

	ll n,m,c;
	cin>>n>>m>>c;
	vector <ll> a(n),b(n);
    for (ll i=0;i<n;i++)
    cin>>a[i];
    for (ll i=0;i<n;i++)
    cin>>b[i];

    ll cnt=0;
    for (ll i=0;i<n;i++)
	{
		if(i<m)
		cnt=(cnt+b[i])%c;

		if(i>n-m)
		cnt=(cnt-b[i-n+m-1]+c)%c;

		cout<<(a[i]+cnt)%c<<" ";
	}
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n,m,c;
	cin>>n>>m>>c;
	int a[n],b[m];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<m;i++)
	{
		cin>>b[i];
	}
	int sum = 0,len = min(n-m+1,m);
	for(int i=0;i<n;i++)
	{
       if(i < len)
       {
       	  sum += b[i];
       }
       else if(i <= n-len)
       {
          if(i < m)
          {
             sum = sum-b[i-len]+b[i];
          }
       }
       else
       {
       	  sum = sum-b[m+i-n-1];
       }
       a[i] = (a[i]+sum)%c;
       cout<<a[i]<<' ';
	}
	cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define sz(v) ((int) (v).size())
#define all(v) (v).begin(), (v).end()
#define ms(x,b) memset(x,b,sizeof(x))
#define sqr(x) ((x)*(x))

typedef string str;
typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpi;

// UTILS
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> int pct(T x) { return __builtin_popcount(x); }
template<class T> int bits(T x) { return T(sizeof(T))*8-__builtin_clz(x); }
template<class T> T divup(T a, T b) { return a/b+!(a<0||a%b == T(0)); }
int fstTrue(function<bool(int)> f, int lo, int hi) {
  hi++; assert(lo <= hi);
  while (lo < hi) {
    int mid = lo + (hi-lo)/2;
    f(mid) ? hi = mid : lo = mid+1; // find first true
  }
  return lo;
}
int fstFalse(function<bool(int)> f, int lo, int hi) {
  hi++; assert(lo <= hi);
  while (lo < hi) {
    int mid = lo + (hi-lo)/2;
    f(mid) ? lo = mid+1 : hi = mid; // find first false
  }
  return lo;
}

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(double& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.fi,p.se); }
template<class A> void re(vector<A>& x) { for (auto &u:x) re(u); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { for (auto &u:x) re(u); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) { stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
  str res = "{";
  for (int i=0;i<sz(v);i++) res += char('0'+v[i]);
  res += "}";
  return res;
}
template<size_t SZ> str ts(bitset<SZ> b) {
  str res = ""; for (int i=0;i<SZ;i++) res += char('0'+b[i]);
  return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) {
  bool f = 1; str r = "{";
  for (const auto& x: v) { if (!f) r += ", "; f = 0; r += ts(x); }
  r += "}"; return r; }
template<class A, class B> str ts(pair<A,B> p) {
  return "("+ts(p.fi)+", "+ts(p.se)+")"; }

// OUTPUT
void pr(double x) { cout << fixed << setprecision(10) << x; }
void pr(ld x) { cout << fixed << setprecision(10) << x; }
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
  pr(h); pr(t...); }
void ps() { pr("\n"); }
template<class H, class... T> void ps(const H& h, const T&... t) {
  pr(h); if (sizeof...(t)) pr(" "); ps(t...); }
template<class A> void pv(A v) { int n = sz(v); for (int j=0;j<n;j++) pr(v[j]," \n"[j==n-1]); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
  cerr << ts(h); if (sizeof...(t)) cerr << ", ";
  DBG(t...); }
#ifdef LOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
  unsyncIO();
  // cin.exceptions(cin.failbit);
  // throws exception when do smth illegal
  // ex. try to read letter into int
  if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
const ld PI = 2*acos(0);
const int INF = 1E9+7;

main() {
  //setbuf(stdout, NULL);
  setIO();

  int n, m, c; re(n, m, c);
  vi a(n); re(a);
  vi b(m); re(b);
  int cur = 0;
  for (int i=0;i<n;i++) {
    if (i < m) cur = (cur+b[i])%c;
    if (i > n-m) cur = (cur+c-b[m-n+i-1])%c;
    a[i] = (a[i]+cur)%c;
  }
  pv(a);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n, m, c, id=0;
    scanf("%I32d %I32d %I32d", &n, &m, &c);
    int a[n], b[n];
    for(int i=0; i<n; i++)
        scanf("%I32d", &a[i]);
    for(int i=0; i<m; i++)
        scanf("%I32d", &b[i]);
    for(int i=0; i<n-m+1; i++)
    {
        id=0;
        for(int j=i; j<(i+m); j++)
            a[j]=(a[j]+b[id])%c,id++;
    }
    printf("%I32d", a[0]);
    for(int i=1; i<n; i++)
        printf(" %I32d", a[i]);
    printf("\n");
}


#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <functional>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);

	int n, m, c;
	cin >> n >> m >> c;

	vector<int> text(n);
	vector<int> key(m);

	for (int& x : text)
		cin >> x;

	vector<int> encryption(text);

	for (int& x : key)
		cin >> x;

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

	for (int e : encryption)
		cout << e << " ";
}


#include <stdlib.h>
#include <iostream>

using namespace std;
int main()
{
    int n, m, c;
    scanf("%d", &n);
    scanf("%d", &m);
    scanf("%d", &c);

    int *a = new int [n] ;
    int *b = new int [m] ;
    int *temp = new int [n] ;

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

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


#include <stdlib.h>
#include <iostream>

using namespace std;
int main()
{
    int n, m, c;
    scanf("%d", &n);
    scanf("%d", &m);
    scanf("%d", &c);

    int *a = new int [n] ;
    int *b = new int [m] ;
    int *temp = new int [n] ;

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

    for (int i = 0; i < n - m + 1; i++)
    {
        for (int j = 0; j < m; j++)
        {
            int b1 = b[j];
            int c2 = temp[i + j];
            temp[i + j] = (temp[i + j] + b[j]) % c;
            int c3 = temp[i + j];
        }
    }
    printf("%d", (a[0]+temp[0]) % c);
    for (int i = 1; i < n; i++)
    {
        printf(" %d", (a[i] + temp[i]) % c);
    }
}


#include <stdlib.h>
#include <iostream>

using namespace std;
int main()
{
    int n, m, c;
    scanf("%d", &n);
    scanf("%d", &m);
    scanf("%d", &c);

    int *a = new int [n] ;
    int *b = new int [m] ;
    int *temp = new int [n] ;

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

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


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

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

using namespace std;

typedef long long int64;
#define INF 1234567890
#define prime 999979
#define FOR(a, b) for(int a = 0; a < b; ++a)
#define eps 1e-7

int n, m, c, sum = 0;
int a[100001], b[100001];

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	scanf("%d%d%d", &n, &m, &c);
	FOR(i, n)
		scanf("%d", &a[i]);
	FOR(i, m)
		scanf("%d", &b[i]);
	FOR(i, n)
	{
		if (i < m)
		{
			sum += b[i];
			sum %= c;
		}
		if (i > n - m)
		{
			sum -= b[i - n + m - 1];
			if (sum < 0) sum += c;
		}
		a[i] += sum;
		a[i] %= c;
	}
	FOR(i, n)
		printf("%d ", a[i]);
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

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

using namespace std;

typedef long long int64;
#define INF 1234567890
#define prime 999979
#define FOR(a, b) for(int a = 0; a < b; ++a)
#define eps 1e-7

int n, m, c, sum = 0;
int a[100001], b[100001];

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	scanf("%d%d%d", &n, &m, &c);
	FOR(i, n)
		scanf("%d", &a[i]);
	FOR(i, m)
		scanf("%d", &b[i]);
	FOR(i, n)
	{
		if (i < m)
		{
			sum += b[i];
			sum %= c;
		}
		if (i > n - m)
		{
			sum -= b[i - n + m];
			if (sum < 0) sum += c;
		}
		a[i] += sum;
		a[i] %= c;
	}
	FOR(i, n)
		printf("%d ", a[i]);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <memory.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <ctime>
using namespace std;
#define TIMER cout << endl <<"Work Program: "<< double(clock()) / CLOCKS_PER_SEC<<" seconds." << endl;
const int MAXN = 100010;
typedef __int64 i64;

int a[MAXN];
int b[MAXN];

int main()
{
	//freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,m,c;
	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]);
	for(int i=0; i<n-m+1; i++)
	{
		for(int j=i; j<i+m; j++)
			a[j]=(a[j]+b[j-i])%c;
	}
	for(int i=0; i<n; i++)
		printf("%d ",a[i]);

	//TIMER;
  return 0;
}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;

    for (int i=1; i<=n; i++)
        cin>>a[i];
    for (int j=1; j<=m; j++)
        cin>>b[j];

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

    for (int i=1; i<=n; i++)
        cout<<a[i]<<" ";
}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;
    for (int i=0; i<n; i++)
        cin>>a[i];
    for (int j=0; j<m; j++)
        cin>>b[j];

    for (int j=0; j<max(m,n-m+1); j++)
        sum=(sum+b[j])%c,d[j]=sum%c;

    for (int i=0; i<n-m+1; i++)
        a[i]=(a[i]+d[i])%c;

     a[n-m+1]+=d[m-1]-d[0];
     a[n-m+1]%=c;

    for (int i=n-m+2; i<n; i++)
        a[i]=(a[i]+b[i-n+m-1])%c;

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


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;

    for (int i=0; i<n; i++)
        cin>>a[i];
    for (int j=0; j<m; j++)
        cin>>b[j];

    for (int j=0; j<max(m,n-m+1); j++)
        sum=(sum+b[j])%c,d[j]=sum%c;

    for (int i=0; i<n-m+1; i++)
        a[i]=(a[i]+d[i])%c;

       int f=n-m,o=b[0],k=0;
    for (int i=n-m+1; i<n; i++)
        a[i]=(a[i]+(d[n-m+1]-o+c))%c,k++,o+=b[k];

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


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;

    for (int i=1; i<=n; i++)
        cin>>a[i];
    for (int j=1; j<=m; j++)
        cin>>b[j];

    for (int j=1; j<=max(m,n-m+1); j++)
        sum=(sum+b[j])%c,d[j]=sum%c;

    for (int i=1; i<=n-m+1; i++)
        a[i]=(a[i]+d[i])%c;

       int f=n-m,o=b[0],k=0;
    for (int i=n-m+2; i<=n; i++)
        a[i]=(a[i]+(d[n-m+1]-o+c)%c)%c,k++,o=(o+b[k])%c;

    for (int i=1; i<=n; i++)
        cout<<a[i]<<" ";
}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;

    for (int i=0; i<n; i++)
        cin>>a[i];
    for (int j=0; j<m; j++)
        cin>>b[j];

    for (int j=0; j<max(m,n-m+1); j++)
        sum=(sum+b[j])%c,d[j]=sum%c;

    for (int i=0; i<n-m+1; i++)
        a[i]=(a[i]+d[i])%c;

       int f=n-m,o=b[0],k=0;
    for (int i=n-m+1; i<n; i++)
        a[i]=(a[i]+(d[n-m+1]-o+c))%c,k++,o=(o+b[k])%c;

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


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <ctime>
#include <list>
#define INF 1100000000
#define MOD 1000000007
#define test 1000000
#define PR 3571
#define ll long long
#define pi 3.141592653589

using namespace std;

int n,m,c,a[100021],b[100021],sum,d[100021];
int main()
{
        cin>>n>>m>>c;

    for (int i=0; i<n; i++)
        cin>>a[i];
    for (int j=0; j<m; j++)
        cin>>b[j];

    for (int j=0; j<max(m,n-m+1); j++)
        sum=(sum+b[j])%c,d[j]=sum%c;

    for (int i=0; i<n-m+1; i++)
        a[i]=(a[i]+d[i])%c;

       int f=n-m,o=b[0],k=0;
    for (int i=n-m+1; i<n; i++)
        a[i]=(a[i]+d[m-1]-o)%c,k++,o+=b[k];

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


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <list>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <iterator>
#include <sstream>
#include <list>
#include <set>
#include <stack>
#include <bitset>
#include <ctime>
#pragma comment(linker, "/STACK:256777216")
#define EPS 1e-7
#define PI 3.1415926535897932384626433832795
using namespace std;
int a[1013],b[1013];
int main(){
    int n,m,c;
    cin>>n>>m>>c;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
    }
    for(int i=1;i<=n-m+1;i++){
        for(int j=1;j<=m;j++){
            a[i+j-1]=(a[i+j-1]+b[j])%c;
        }
    }
    for(int i=1;i<=n;i++){
        cout<<a[i]<<" ";
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <list>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <iterator>
#include <sstream>
#include <list>
#include <set>
#include <stack>
#include <bitset>
#include <ctime>
#pragma comment(linker, "/STACK:256777216")
#define EPS 1e-7
#define PI 3.1415926535897932384626433832795
using namespace std;
long long a[100013],b[100013],tr[4*100013];
int n,m,c;
void build(int idx,int l,int r){
    if (l==r){
        tr[idx]=b[l];
    }
    else {
        int mid=(l+r)>>1;
        build(2*idx,l,mid);
        build(2*idx+1,mid+1,r);
        tr[idx]=tr[2*idx]+tr[2*idx+1];
    }
}
long long summ(int idx,int l,int r,int from,int to){
    if (l>r)
        return 0;
    if (l==from && r==to){
        return tr[idx];
    }
    int mid=(l+r)>>1;
    return summ(2*idx,l,mid,from,min(r,to))+summ(2*idx+1,mid+1,r,max(from,mid+1),to);
}
long long sum(int idx, int tl, int trr, int l, int r) {
    if (l > r)
        return 0;
    if (l == tl && r == trr)
        return tr[idx];
    int tm = (tl + trr)>>1;
    return sum (idx*2, tl, tm, l, min(r,tm))
        + sum (idx*2+1, tm+1, trr, max(l,tm+1), r);
}
int main(){
    cin>>n>>m>>c;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
    build(1,0,m-1);
    int k=min(m,n-m+1);
    for(int i=1;i<=k;i++){
        a[i]=(a[i]+sum(1,0,m-1,0,i-1))%c;
    }
    int kk=n-m+1;
    for(int i=k+1;i<=kk;i++){
        a[i]=(a[i]+sum(1,0,m-1,0,m-1))%c;
    }
    for(int i=n,j=m;i>kk;i--,j--){
        a[i]=(a[i]+sum(1,0,m-1,j-1,m-1))%c;
    }
    for(int i=1;i<=n;i++){
        printf("%d ",a[i]);
    }

    return 0;
}


// In The Name Of God
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <set>
#include <map>

using namespace std;

#define REP(i,n) for((i)=0;(i)<(n);(i)++)
#define FOR(i,t,n) for((i)=(t);(i)<(n);(i)++)
typedef long long ll;

const int maxn = 100*1000+100;
int a[maxn],b[maxn];

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


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> mass1(n);
	vector<int> mass2(n);
	for(int i = 0; i < n; i++)
		cin >> mass1[i];
	vector<int> sum;
	for(int i = 0; i < m; i++)
	{
		cin >> mass2[i];
		if(sum.size() == 0)
			sum.push_back(mass2[i]);
		else
			sum.push_back(mass2[i] + mass2[i - 1]);
	}
	for(int i = m; i < n - m + 1; i++)
	{
		mass1[i] += sum[sum.size() - 1];
		mass1[i] %= k;
	}
	for(int i = 0; i < m; i++)
	{
		mass1[i] += sum[i];
		mass1[i] %= k;
	}
	int index = sum.size() - 2;
	for(int i = n - m + 1; i < n; i++)
	{
		mass1[i] += sum[index--];
		mass1[i] %= k;
	}
	for(int i = 0; i < mass1.size(); i++)
		cout << mass1[i] << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	if(m < n - m + 1)
	{
		vector<int> mass1(n);
		vector<int> mass2(n);
		for(int i = 0; i < n; i++)
			cin >> mass1[i];
		vector<int> sum;
		for(int i = 0; i < m; i++)
		{
			cin >> mass2[i];
			if(sum.size() == 0)
				sum.push_back(mass2[i]);
			else
				sum.push_back(mass2[i] + sum[i - 1]);
		}
		for(int i = m; i < n - m + 1; i++)
		{
			mass1[i] += sum[sum.size() - 1];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
		{
			mass1[i] += sum[i];
			mass1[i] %= k;
		}
		vector<int> sum2;
		int index = 0;
		for(int i = mass2.size() - 1; i >= 0; i--)
		{
			if(i == mass2.size() - 1)
				sum2.push_back(mass2[i]);
			else
				sum2.push_back(mass2[i] + sum2[index - 1]);
			index++;
		}
		for(int i = n - m + 1; i < n; i++)
		{
			mass1[i] += sum2[i - n + m - 1];
			mass1[i] %= k;
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	else
	{
		vector<int> mass1(n);
		vector<int> mass2(n);
		for(int i = 0; i < n; i++)
		{
			cin >> mass1[i];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
			cin >> mass2[i];
		for(int i = 0; i < n - m + 1; i++)
		{
			for(int j = 0; j < m; j++)
			{
				mass1[i + j] += mass2[j];
				mass1[i + j] %= k;
			}
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	if(m < n - m + 1)
	{
		vector<int> mass1(n);
		vector<int> mass2(n);
		for(int i = 0; i < n; i++)
			cin >> mass1[i];
		vector<int> sum;
		for(int i = 0; i < m; i++)
		{
			cin >> mass2[i];
			if(sum.size() == 0)
				sum.push_back(mass2[i]);
			else
				sum.push_back(mass2[i] + sum[i - 1]);
		}
		for(int i = m; i < n - m + 1; i++)
		{
			mass1[i] += sum[sum.size() - 1];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
		{
			mass1[i] += sum[i];
			mass1[i] %= k;
		}
		int index = sum.size() - 2;
		for(int i = n - m + 1; i < n; i++)
		{
			mass1[i] += sum[index--];
			mass1[i] %= k;
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	else
	{
		vector<int> mass1(n);
		vector<int> mass2(n);
		for(int i = 0; i < n; i++)
		{
			cin >> mass1[i];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
			cin >> mass2[i];
		for(int i = 0; i < n - m + 1; i++)
		{
			for(int j = 0; j < m; j++)
			{
				mass1[i + j] += mass2[j];
				mass1[i + j] %= k;
			}
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	if(m < n - m + 1)
	{
		vector<int> mass1(n);
		vector<int> mass2(m);
		for(int i = 0; i < n; i++)
			cin >> mass1[i];
		vector<int> sum;
		for(int i = 0; i < m; i++)
		{
			cin >> mass2[i];
			if(sum.size() == 0)
				sum.push_back(mass2[i]);
			else
				sum.push_back(mass2[i] + sum[i - 1]);
		}
		for(int i = m; i < n - m /* + 1 */; i++)
		{
			mass1[i] += sum[sum.size() - 1];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
		{
			mass1[i] += sum[i];
			mass1[i] %= k;
		}
		vector<int> sum2;
		int index = 0;
		for(int i = mass2.size() - 1; i >= 0; i--)
		{
			if(i == mass2.size() - 1)
				sum2.push_back(mass2[i]);
			else
				sum2.push_back(mass2[i] + sum2[index - 1]);
			index++;
		}
		for(int i = n - m; i < n; i++)
		{
			mass1[i] += sum2[sum2.size() - (i - n + m) - 1];
			mass1[i] %= k;
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	else
	{
		vector<int> mass1(n);
		vector<int> mass2(n);
		for(int i = 0; i < n; i++)
		{
			cin >> mass1[i];
			mass1[i] %= k;
		}
		for(int i = 0; i < m; i++)
			cin >> mass2[i];
		for(int i = 0; i < n - m + 1; i++)
		{
			for(int j = 0; j < m; j++)
			{
				mass1[i + j] += mass2[j];
				mass1[i + j] %= k;
			}
		}
		for(int i = 0; i < mass1.size(); i++)
			cout << mass1[i] << " ";
		cout << endl;
	}
	return 0;
}


//In The Name Of God

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int a[100000 + 1];
int b[100000 + 1];
int p[100000 + 1];
int ans[100000 + 1];

int main()
{
	memset(p , 0 , sizeof p);
	memset(ans , 0 , sizeof ans);
	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];
	for(int i = 1 ; i <= n ; i++)
		if(m <= i)
			p[i - 1] = min(m , n - i + 1);
		else
			p[i - 1] = min(i , n - i + 1);
	for(int i = 0 ; i < n ; i++)
	{
		ans[i] = a[i];
		for(int j = 0 ; j < p[i] ; j++)
			ans[i] += b[j];
		cout<<ans[i] % c<<' ';
	}
	return 0;
}


//In The Name Of God

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int a[100000 + 1];
int b[100000 + 1];
int p[100000 + 1];
int ans[100000 + 1];

int main()
{
    memset(p , 0 , sizeof p);
    memset(ans , 0 , sizeof ans);
    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];
    for(int i = 1 ; i <= n ; i++)
        if(m <= i)
            p[i - 1] = min(m , n - i + 1);
        else
            p[i - 1] = min(i , n - m + 1);
    for(int i = 0 ; i < n ; i++)
    {
        ans[i] = a[i];
        for(int j = 0 ; j < p[i] ; j++)
            ans[i] += b[j];
        cout<<ans[i] % c<<' ';
    }
    return 0;
}


//In The Name Of God

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int a[100000 + 1];
int b[100000 + 1];

int 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];
    for(int i = 0 ; i + m - 1 < n ; i++)
        for(int j = i ; j < i + m ; j++)
            a[j] += b[j - i];
    for(int i = 0 ; i < n ; i++)
        cout<<a[i] % c<<' ';
    return 0;
}


//In The Name Of God

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int a[100000 + 1];
int b[100000 + 1];
int p[100000 + 1];
int k[100000 + 1];
int ans[100000 + 1];

int main()
{
	memset(p , 0 , sizeof p);
	memset(ans , 0 , sizeof ans);
	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];
	for(int i = 1 ; i <= n ; i++)
		if(m <= i)
			if(m <= n - i + 1)
			{
				p[i - 1] = n;
				k[i - 1] = 1;
			}
			else
			{
				p[i - 1] = n - i + 1;
				k[i - 1] = 2;
			}
		else
		{
			k[i - 1] = 1;
			p[i - 1] = min(i , n - m + 1);
		}
	for(int i = 0 ; i < n ; i++)
	{
		ans[i] = a[i];
		for(int j = 0 ; j < p[i] ; j++)
			if(k[i] == 1)
				ans[i] += b[j];
			else
				ans[i] += b[m - j - 1];
		cout<<ans[i] % c<<' ';
	}
	return 0;
}


//In The Name Of God

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int a[100000 + 1];
int b[100000 + 1];
int p[100000 + 1];
int k[100000 + 1];
int ans[100000 + 1];

int main()
{
    memset(p , 0 , sizeof p);
    memset(ans , 0 , sizeof ans);
    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];
    for(int i = 1 ; i <= n ; i++)
        if(m <= i)
            if(m <= n - i + 1)
            {
                p[i - 1] = m;
                k[i - 1] = 1;
            }
            else
            {
                p[i - 1] = n - i + 1;
                k[i - 1] = 2;
            }
        else
        {
            k[i - 1] = 1;
            p[i - 1] = min(i , n - m + 1);
        }
    for(int i = 0 ; i < n ; i++)
    {
        ans[i] = a[i];
        for(int j = 0 ; j < p[i] ; j++)
            if(k[i] == 1)
                ans[i] += b[j];
            else
                ans[i] += b[m - j - 1];
        cout<<ans[i] % c<<' ';
    }
    return 0;
}


#include<stdlib.h>
#include<stdio.h>
#include<vector>

using namespace std;

int main()
{
	int n, m, c;
	scanf("%d%d%d", &n,&m,&c);
	vector<int> p1;
	vector<int> p2;
	int curr;
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &curr);
		p1.push_back(curr);
	}
	for(int i = 0; i < m; i++)
	{
		scanf("%d", &curr);
		p2.push_back(curr);
	}
	for(int i = 0; i < n-m+1; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if((p1[j+i]+p2[j])>=c)
				p1[j+i] = p1[j+i]+p2[j]-c;
			else
				p1[j+i] = p1[j+i]+p2[j];
		}
	}
	for(int i = 0; i < n; i++)
		printf("%d ", p1[i]);
	return 0;
}


#include <iostream>

using namespace std;

int main(){
    int m,n,c;
    cin >> m >> n >> c;

    int ar[100000];
    int at[100000];

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

    for(int j=0;j<n;j++){
        cin >>at[j];
        for (int k=j;k<=m-n+j;k++){
            ar[k]=ar[k]+at[j];
            if (ar[k]>=c)
                ar[k]=ar[k]-c;
        }
    }
    for (int i = 0; i< m;i++)
        cout << ar[i];

    return 0;

}


#include <iostream>

using namespace std;

int main(){
    int m,n,c;
    cin >> m >> n >> c;

    int ar[100000];
    int at[100000];

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

    for(int j=0;j<n;j++){
        cin >>at[j];
        for (int k=j;k<=m-n+j;k++){
            ar[k]=ar[k]+at[j];
            if (ar[k]>=c)
                ar[k]=ar[k]-c;
        }
    }
    for (int i = 0; i< m;i++)
        cout << ar[i]<< ' ';

    return 0;

}


#pragma comment(linker, "/stack:64000000")

#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long llong;

const int MAX = 100000 + 10;
int a[MAX], p[MAX];
int res[MAX];

int main() {
#ifdef LOCAL
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	memset(res, -1, sizeof(res));
	int n, m, MOD;
	scanf("%d %d %d", &n, &m, &MOD);
	REP(i, n) scanf("%d", &a[i + 1]);
	p[0] = 0;
	REP(i, m) {
		int t;
		scanf("%d", &t);
		p[i + 1] = (p[i] + t) % MOD;
	}
	for (int i = 1; i <= min(m, n - m + 1); i++) {
		res[i] = (a[i] + p[i]) % MOD;
	}
	for (int i = n, j = m; i >= max(n - m + 1, n - (n - m + 1) + 1); i--, j--) {
		res[i] = (a[i] + p[m] - p[j - 1] + 2 * MOD) % MOD;
	}
	REP(i, n) if (res[i + 1] == -1) res[i + 1] = (a[i + 1] + p[m]) % MOD;
	REP(i, n) printf("%d ", res[i + 1]);
	return 0;
}


#pragma comment(linker, "/stack:64000000")

#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long llong;

const int MAX = 100000 + 10;
int a[MAX], b[MAX];

int main() {
#ifdef LOCAL
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	int n, m, MOD;
	scanf("%d %d %d", &n, &m, &MOD);
	REP(i, n) scanf("%d", &a[i]);
	REP(i, m) scanf("%d", &b[i]);
	REP(i, n - m + 1) {
		REP(j, m) {
			a[i + j] += b[j];
			a[i + j] %= MOD;
		}
	}
	REP(i, n) printf("%d ", a[i]);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main ()
{
	long long i,j1,j2,e=0,g,n,m,c,z=0;
	vector <long long> l,k;
	cin>>n>>m>>c;
	for (i=0;i<n;i++)
	{
		cin>>e;
		l.push_back(e%c);
	}
	for (i=0;i<m;i++)
	{
		cin>>e;
		k.push_back(e%c);
	}
	e=0;
	j1=0;
	j2=0;
	for (i=0;i<n;i++)
	{
		if (j1!=k.size()) {e=e+k[j1];
		j1++;}
		if (z==1 && j2!=k.size()) {e=e-k[j2];j2++;}
		l[i]=(l[i]+e)%c;
		if (i+k.size()==n) z=1;
	}
	for (i=0;i<n;i++)
	{
		cout<<l[i]<<" ";
	}
	return 0;
}


#include <functional>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <numeric>
#include <bitset>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <map>

#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef pair< int, int > pii;
typedef vector< int > vint;
typedef vector< int64 > vint64;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forr(i, n) for (int i = (n) - 1; i >= 0; --i)

const int UNDEF = -1;
const int INF = 2000000000;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

template< typename T >
const T sqr(const T &x)
{
	return x * x;
}

template< typename T >
const string GetString(const T &val)
{
	ostringstream sout;
	sout << val;
	return sout.str();
}

const int MAXN = 10000 + 5;

int n, m, c;
int a[MAXN], b[MAXN];
int pref[MAXN];

void Init()
{
	cin >> n >> m >> c;
	forn (i, n)
	{
		scanf("%d", &a[i]);
	}
	forn (i, m)
	{
		scanf("%d", &b[i]);
		pref[i] = b[i];
		if (i) pref[i] += pref[i - 1];
	}
}

int GetSum(int l, int r)
{
	if (l > r) return 0;
	int res = pref[r];
	if (l) res -= pref[l - 1];
	return res % c;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("D.txt", "r", stdin);
#endif

	Init();
	int k = min(n - m + 1, m);
	int l = 0, r = 0;
	int pos = 0;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l, r++) + a[pos++]) % c);
	}
	forn (i, n - 2 * (k - 1))
	{
		printf("%d ", (GetSum(l, r) + a[pos++]) % c);
		if (r < m - 1) ++l, ++r;
	}
	l, --r;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l++, r) + a[pos++]) % c);
	}
	cout << endl;

	return 0;
}


#include <functional>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <numeric>
#include <bitset>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <map>

#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef pair< int, int > pii;
typedef vector< int > vint;
typedef vector< int64 > vint64;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forr(i, n) for (int i = (n) - 1; i >= 0; --i)

const int UNDEF = -1;
const int INF = 2000000000;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

template< typename T >
const T sqr(const T &x)
{
	return x * x;
}

template< typename T >
const string GetString(const T &val)
{
	ostringstream sout;
	sout << val;
	return sout.str();
}

const int MAXN = 10000 + 5;

int n, m, c;
int a[MAXN], b[MAXN];
int pref[MAXN];

void Init()
{
	cin >> n >> m >> c;
	forn (i, n)
	{
		scanf("%d", &a[i]);
	}
	forn (i, m)
	{
		scanf("%d", &b[i]);
		pref[i] = b[i];
		if (i) pref[i] += pref[i - 1];
	}
}

int GetSum(int l, int r)
{
	if (l > r) return 0;
	int res = pref[r];
	if (l) res -= pref[l - 1];
	return res % c;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("D.txt", "r", stdin);
#endif

	Init();
	int k = min(n - m + 1, m);
	int l = 0, r = 0;
	int pos = 0;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l, r++ % m) + a[pos++]) % c);
	}
	forn (i, n - 2 * (k - 1))
	{
		printf("%d ", (GetSum(l++ % m, r++ % m) + a[pos++]) % c);
	}
	l, --r;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l++ % m, r) + a[pos++]) % c);
	}
	cout << endl;

	return 0;
}


#include <functional>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <numeric>
#include <bitset>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <map>

#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef pair< int, int > pii;
typedef vector< int > vint;
typedef vector< int64 > vint64;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forr(i, n) for (int i = (n) - 1; i >= 0; --i)

const int UNDEF = -1;
const int INF = 2000000000;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

template< typename T >
const T sqr(const T &x)
{
	return x * x;
}

template< typename T >
const string GetString(const T &val)
{
	ostringstream sout;
	sout << val;
	return sout.str();
}

const int MAXN = 10000 + 5;

int n, m, c;
int a[MAXN], b[MAXN];
int pref[MAXN];

void Init()
{
	cin >> n >> m >> c;
	forn (i, n)
	{
		scanf("%d", &a[i]);
	}
	forn (i, m)
	{
		scanf("%d", &b[i]);
		pref[i] = b[i];
		if (i) pref[i] += pref[i - 1];
	}
}

int GetSum(int l, int r)
{
	int res = pref[r];
	if (l) res -= pref[l - 1];
	return res;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("D.txt", "r", stdin);
#endif

	Init();
	int k = min(n - m + 1, m);
	int l = 0, r = 0;
	int pos = 0;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l, r++) + a[pos++]) % c);
	}
	forn (i, n - 2 * (k - 1))
	{
		printf("%d ", (GetSum(l, r) + a[pos++]) % c);
		if (r < m - 1 || i == n - 2 * (k - 1) - 1) ++l, ++r;
	}
	l, --r;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l++, r) + a[pos++]) % c);
	}
	cout << endl;

	return 0;
}


#include <functional>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <numeric>
#include <bitset>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <map>

#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef pair< int, int > pii;
typedef vector< int > vint;
typedef vector< int64 > vint64;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forr(i, n) for (int i = (n) - 1; i >= 0; --i)

const int UNDEF = -1;
const int INF = 2000000000;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

template< typename T >
const T sqr(const T &x)
{
	return x * x;
}

template< typename T >
const string GetString(const T &val)
{
	ostringstream sout;
	sout << val;
	return sout.str();
}

const int MAXN = 10000 + 5;

int n, m, c;
int a[MAXN], b[MAXN];
int pref[MAXN];

void Init()
{
	cin >> n >> m >> c;
	forn (i, n)
	{
		scanf("%d", &a[i]);
	}
	forn (i, m)
	{
		scanf("%d", &b[i]);
		pref[i] = b[i];
		if (i) pref[i] += pref[i - 1];
	}
}

int GetSum(int l, int r)
{
	l = max(l, 0);
	l = min(l, m - 1);
	r = min(r, m - 1);
	r = max(r, 0);
	int res = pref[r];
	if (l) res -= pref[l - 1];
	return res;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("D.txt", "r", stdin);
#endif

	Init();
	int k = min(n - m + 1, m);
	int l = min(-m + 2, 0), r = 0;
	int pos = 0;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l++, r++) + a[pos++]) % c);
	}
	forn (i, n - 2 * (k - 1))
	{
		printf("%d ", (GetSum(l++, r++) + a[pos++]) % c);
	}
	l, --r;
	forn (i, k - 1)
	{
		printf("%d ", (GetSum(l++, r++) + a[pos++]) % c);
	}
	cout << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
#include <fstream>

#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FO ifstream fin("test.txt")

using namespace std;

int main () {
	//setlocale( LC_ALL,"Russian" );
	//FO;
	int n, m, c , a[100000], k[100000];
	cin >> n >> m >> c;
	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	for (int i=0; i<m; i++) {
		cin >> k[i];
	}
	for (int i=0; i+m<=n; i++) {
		for (int j=0,f=i; j<m; j++, f++) {
			a[f]+= k[j];
			a[f] = a[f]%c;
		}
	}
	for (int i=0; i<n; i++) {
		cout << a[i];
	}

	//cout << sum;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
#include <fstream>

#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FO ifstream fin("test.txt")

using namespace std;

int main () {
	//setlocale( LC_ALL,"Russian" );
	//FO;
	int n, m, c , a[100000], k[100000];
	cin >> n >> m >> c;
	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	for (int i=0; i<m; i++) {
		cin >> k[i];
	}
	for (int i=0; i+m<=n; i++) {
		for (int j=0,f=i; j<m; j++, f++) {
			a[f]+= k[j];
			a[f] = a[f]%c;
		}
	}
	for (int i=0; i<n; i++) {
		cout << a[i] << " ";
	}

	//cout << sum;

	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	vector<int> s(m, 0);
	s[0] = b[0];
	for(int i = 1; i < m; ++i)
	{
		s[i] = s[i - 1] + b[i];
		s[i] %= c;
	}
	for(int i = m - 1; i < n - m + 1; ++i)
		a[i] = (a[i] + s[m - 1]) % c;
	for(int i = 0; i < m - 1; ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + s[i]) % c;
	}
	for(int i = 0; i < n; ++i)
		printf("%d ", a[i]);
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	if(n == m)
	{
		for(int i = 0; i < n; ++i)
			printf("%d ", (a[i] + b[i]) % c);
		return 0;
	}
	vector<int> s(m, 0), rs(m, 0);
	s[0] = b[0];
	rs[0] = b[m - 1];
	for(int i = 1; i < m; ++i)
	{
		s[i] = (s[i - 1] + b[i]) % c;
		rs[i] = (rs[i - 1] + b[m - i - 1]) % c;
	}
	bool was = 0;
	for(int i = m - 1; i < n - m + 1; ++i)
	{
		a[i] = (a[i] + s[m - 1]) % c;
		was = 1;
	}

	if(was)
	{
		for(int i = 0; i < m - 1; ++i)
		{
			a[i] = (a[i] + s[i]) % c;
			a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
		}
		for(int i = 0; i < n; ++i)
			printf("%d ", a[i]);
		return 0;
	}
	/*for(int i = 0; i < min(n - m + 1, m - 1); ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
	}*/
	/*for(int i = min(n - m + 1, m - 1); i < m - 1; ++i)
	{
		a[i] = (a[i] + s[i] - s[i - n + m - 1] ) % c;
	}*/
	for(int i = 0; i < n - m + 1; ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
	}
	int k = 0;
	for(int i = n - m + 1; i < m - 1; ++i)
		a[i] = (a[i] + s[i] - s[k++]) % c;

	for(int i = 0; i < n; ++i)
		printf("%d ", a[i]);
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	if(n == m)
	{
		for(int i = 0; i < n; ++i)
			printf("%d ", (a[i] + b[i]) % c);
		return 0;
	}
	vector<int> s(m, 0), rs(m, 0);
	s[0] = b[0];
	rs[0] = b[m - 1];
	for(int i = 1; i < m; ++i)
	{
		s[i] = (s[i - 1] + b[i]) % c;
		rs[i] = (rs[i - 1] + b[m - i - 1]) % c;
	}
	for(int i = m - 1; i < n - m + 1; ++i)
		a[i] = (a[i] + s[m - 1]) % c;

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


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	if(n == m)
	{
		for(int i = 0; i < n; ++i)
			printf("%d ", (a[i] + b[i]) % c);
		return 0;
	}
	vector<int> s(m, 0), rs(m, 0);
	s[0] = b[0];
	rs[0] = b[m - 1];
	for(int i = 1; i < m; ++i)
	{
		s[i] = (s[i - 1] + b[i]) % c;
		rs[i] = (rs[i - 1] + b[m - i - 1]) % c;
	}
	bool was = 0;
	for(int i = m - 1; i < n - m + 1; ++i)
	{
		a[i] = (a[i] + s[m - 1]) % c;
		was = 1;
	}

	for(int i = 0; i < min(n - m + 1, m - 1); ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
	}
	for(int i = min(n - m + 1, m - 1); i < m - 1; ++i)
	{
		a[i] = (a[i] + s[i] - s[i - n + m - 1] ) % c;
	}

	for(int i = 0; i < n; ++i)
		printf("%d ", a[i]);
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	if(n == m)
	{
		for(int i = 0; i < n; ++i)
			printf("%d ", (a[i] + b[i]) % c);
		return 0;
	}
	vector<int> s(m, 0), rs(m, 0);
	s[0] = b[0];
	rs[0] = b[m - 1];
	for(int i = 1; i < m; ++i)
	{
		s[i] = (s[i - 1] + b[i]) % c;
		rs[i] = (rs[i - 1] + b[m - i - 1]) % c;
	}
	bool was = 0;
	for(int i = m - 1; i < n - m + 1; ++i)
	{
		a[i] = (a[i] + s[m - 1]) % c;
		was = 1;
	}

	if(was)
	{
		for(int i = 0; i < m - 1; ++i)
		{
			a[i] = (a[i] + s[i]) % c;
			a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
		}
		for(int i = 0; i < n; ++i)
			printf("%d ", a[i]);
		return 0;
	}
	for(int i = 0; i < min(n - m + 1, m - 1); ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
	}
	for(int i = min(n - m + 1, m - 1); i < m - 1; ++i)
	{
		a[i] = (a[i] + s[i] - s[i - n + m - 1] ) % c;
	}

	for(int i = 0; i < n; ++i)
		printf("%d ", a[i]);
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	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)
		printf("%d ", a[i]);
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <iomanip>
#include <ctime>
#include <iostream>
#include <sstream>
#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
template<class T> inline T sqr(T a) {return a * a;}
#define INF 123456789
#define MOD 1000000007
#define PRIME 1103
#define TEST "test"

int main()
{
#ifndef ONLINE_JUDGE
	freopen(TEST ".in", "r", stdin);
	freopen(TEST ".out", "w", stdout);
#endif
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> a(n);
	vector<int> b(m);
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	for(int i = 0; i < m; ++i)
		scanf("%d", &b[i]);
	if(n == m)
	{
		for(int i = 0; i < n; ++i)
			printf("%d ", (a[i] + b[i]) % c);
		return 0;
	}
	vector<int> s(m, 0), rs(m, 0);
	s[0] = b[0];
	rs[0] = b[m - 1];
	for(int i = 1; i < m; ++i)
	{
		s[i] = (s[i - 1] + b[i]) % c;
		rs[i] = (rs[i - 1] + b[m - i - 1]) % c;
	}
	if(m < n - m + 1)
	{
		for(int i = m - 1; i < n - m + 1; ++i)
			a[i] = (a[i] + s[m - 1]) % c;
		for(int i = 0; i < m - 1; ++i)
		{
			a[i] = (a[i] + s[i]) % c;
			a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
		}
		for(int i = 0; i < n; ++i)
			printf("%d ", a[i]);
		return 0;
	}

	for(int i = 0; i < n - m + 1; ++i)
	{
		a[i] = (a[i] + s[i]) % c;
		a[n - i - 1] = (a[n - i - 1] + rs[i]) % c;
	}
	for(int i = 0; i < 2 * m - n - 2; ++i)
	{
		a[n - m + i + 1] = (a[n - m + i + 1] + s[i + n - m + 1] - s[i]) % c;
	}

	for(int i = 0; i < n; ++i)
		printf("%d ", a[i]);
	return 0;
}


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

using namespace std;
typedef long long int64;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int64 n, m, c;
	cin >> n >> m >> c;

	vector<int64> a(n), b(m), sub(n);

	for (int64 i = 0; i < n; i++) cin >> a[i];
	for (int64 i = 0; i < m; i++) cin >> b[i];

	sub[0] = b[0];
	cout << (a[0] + sub[0]) % c << " ";
	for (int64 i = 1; i < n; i++)
	{
		sub[i] = sub[i - 1];
		if (i <m)
			sub[i]+=b[i];
	    if (i>n - m)
			sub[i] -= b[n-i];

		//cout << sub[i] << " ";
		cout << (a[i] + sub[i]) % c << " ";
	}

	return 0;
}
/*
cin >> n >> k;

g.resize(n);

for (int64 i = 0; i < k; i++)
{
	int64 a, b;
	cin >> a >> b;
	a--;
	b--;
	g[a].to.push_back(edge(b, 0));
	g[b].to.push_back(edge(a, 0));
}

map<int64, int64> ma;
for (int64 i = 0; i < n; i++)
{
	if (g[i].col == 0)
		ma[i + 1] = dfs(i, i + 1);
}

cin >> m;
vector<>
for (int64 i = 0; i < m; i++)
{
	int64 a, b;
	cin >> a >> b;
	a--;
	b--;
	if (g[a].col == g[b].col)
		ma[g[a].col] = 1;
}
int64 maxi = 0;

for (const auto& : i)

for (auto i = ma.begin(); i != ma.end(); i++)
{
	maxi = max(maxi, i.second);
}

int64 n, k, m;
struct edge
{
int64 to, type;
edge(){}
edge(int64 x, int64 y)
{
to = x;
type = y;
}

};
struct node
{
int64 col;
vector<edge> to;
node(){ col = 0; }
};

vector<node> g;

int64 dfs(int64 u, int64 v)
{
g[u].col = v;
int64 res = 1;
for (int64 i = 0; i < g[u].to.size(); i++)
{
if (g[u].to[i].type == 1)
{
continue;
}

int64 to = g[u].to[i].to;

if (g[to].col == 0)
res += dfs(to, v);
}

return res;
}
*/


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

using namespace std;
typedef long long int64;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int64 n, m, c;
	cin >> n >> m >> c;

	vector<int64> a(n), b(m), sub(n);

	for (int64 i = 0; i < n; i++) cin >> a[i];
	int64 sum = 0;
	for (int64 i = 0; i < m; i++){ cin >> b[i]; sum += b[i]; };

	sub[0] = b[0];
	for (int64 i = 1, j=0; i < n; i++)
	{
		sub[i] = sub[i - 1];
		if (i<m)
		{
			sub[i] += b[i];
		}

	}
	int64 t = n - m + 1;
	for (int64 i = 0; i < n; i++)
		cout << (a[i] + sub[i]-(i-t<0?0:sub[i-t])) % c << " ";
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    int *a;
    int *b;
    int *b1;
    int *b2;
    int i, j;
    a =(int*) malloc(n*sizeof(int));
    b =(int*) malloc(n*sizeof(int));
    b1 =(int*) malloc(n*sizeof(int));
    b2 =(int*) malloc(n*sizeof(int));
    for(i=0; i<n; i++)
        cin>>a[i];
    for(i=0; i<m; i++)
    {
        cin>>b[i];
        b1[i] = b[i];
        b2[i] = b[i];
    }
    j = m-1;
    for(i=n-1; i>=max(n-m-1, m);i--)
    {
        b1[i] = b1[j];
        j--;
    }
    for(i=1; i<m; i++)
    {
        b2[i] = (b2[i] + b2[i-1])%c;
    }
    for(i=1; i<n - m+1 && i<m; i++)
    {

        b1[i] = (b1[i]+ b1[i-1])%c;
    }
    if(n-m+1 < m)
    {
        for(i=n-m+1; i<m; i++)
        {
            b1[i] = (b2[i] - b2[i - (n-m+1)])%c;
        }
        b1[n-1] = b[m-1];
        for(i=n-2; i>= m; i--)
        {
            b1[i] = (b1[i] + b1[i+1])%c;
        }

    }
    else
    {
        for(i=m; i<n-m+1; i++)
        {
            b1[i] = b1[m-1];
        }
        for(i=n-2; i>=n-m+1; i--)
        {
            b1[i] = (b1[i] + b1[i+1])%c;
        }
    }
    for (i=0; i<n; i++)
    {
        a[i]= (a[i] + b1[i])%c;
        printf("%d ", a[i]);
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    int *a;
    int *b;
    int *b1;
    int *b2;
    int i, j;
    a =(int*) malloc(n*sizeof(int));
    b =(int*) malloc(n*sizeof(int));
    b1 =(int*) malloc(n*sizeof(int));
    b2 =(int*) malloc(n*sizeof(int));
    for(i=0; i<n; i++)
        cin>>a[i];
    for(i=0; i<m; i++)
    {
        cin>>b[i];
    }
    for(i=0; i<n-m+1; i++)
    {
        for(j=0; j<m; j++)
        {
            a[i+j] = (a[i+j] + b[j])%c;
        }
    }
    for(i=0;i<n;i++)
    {
        cout<<a[i]<<" ";
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n,m,c;
    cin>>n>>m>>c;
    int *a;
    int *b;
    int *b1;
    int *b2;
    int i, j;
    a =(int*) malloc(n*sizeof(int));
    b =(int*) malloc(n*sizeof(int));
    b1 =(int*) malloc(n*sizeof(int));
    b2 =(int*) malloc(n*sizeof(int));
    for(i=0; i<n; i++)
        cin>>a[i];
    for(i=0; i<m; i++)
    {
        cin>>b[i];
        b1[i] = b[i];
        b2[i] = b[i];
    }
    j = m-1;
    for(i=n-1; i>=max(n-m-1, m);i--)
    {
        b1[i] = b1[j];
        j--;
    }
    for(i=1; i<m; i++)
    {
        b2[i] = (b2[i] + b2[i-1])%c;
    }
    for(i=1; i<n - m+1 && i<m; i++)
    {

        b1[i] = (b1[i]+ b1[i-1])%c;
    }
    if(n-m+1 < m)
    {
        for(i=n-m+1; i<m; i++)
        {
            b1[i] = (b2[i] - b2[i - (n-m+1)] + c)%c;
        }
        b1[n-1] = b[m-1];
        for(i=n-2; i>= m; i--)
        {
            b1[i] = (b1[i] + b1[i+1])%c;
        }

    }
    else
    {
        for(i=m; i<n-m+1; i++)
        {
            b1[i] = b1[m-1];
        }
        for(i=n-2; i>=n-m+1; i--)
        {
            b1[i] = (b1[i] + b1[i+1])%c;
        }
    }
    for (i=0; i<n; i++)
    {
        a[i]= (a[i] + b1[i])%c;
        cout<<a[i]<<" ";
    }

    return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	end[m-1]=b[m-1];
	for(int i=m-2;i>=0;i--)
	{
		end[i]=end[i+1]+b[i];
	}

	int cur=0;

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

	int pos=0;
	stack<int> q;
	for(int i=n-1;i>n-m;i--)
	{
		if(pos>m-1)
		{
			cur=(a[i]+f[m-1])%c;
			q.push(cur);
		}
		else
		{
			cur=(a[i]+end[pos])%c;
			q.push(cur);
		}

		pos++;
	}

	while(!q.empty())
	{
		int v=q.top();q.pop();
		printf("%d ",v);
	}
	return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

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

	int pos=0;
	stack<int> q;
	for(int i=n-1;i>n-m;i--)
	{
		if(pos>m-1)
		{
			cur=(a[i]+f[m-1])%c;
			q.push(cur);
		}
		else
		{
			cur=(a[i]+end[pos])%c;
			q.push(cur);
		}

		pos++;
	}

	while(!q.empty())
	{
		int v=q.top();q.pop();
		printf("%d ",v);
	}
	return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

	for(int i=0;i<n;i++)
	{
		int len=min(i+1,n-i);
		if(len>=m)
		{
			cur=(a[i]+f[m-1])%c;
		}
		else
		{
			if(i+1<n-i)
			{
				cur=(a[i]+f[i])%c;
			}
			else
			{
				cur=(a[i]+end[n-i-1])%c;
			}
		}
		printf("%d ",cur);
	}//for(int i=0;i<n;i++)
	return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

	if(n>=m+m)
	{
		for(int i=0;i<m;i++)
		{
			cur=(a[i]+f[i])%c;
			printf("%d ",cur);
		}
		for(int i=m;i<n-m;i++)
		{
			cur=(a[i]+f[m-1])%c;
			printf("%d ",cur);
		}
		int pos=0;
		for(int i=n-m;i<n;i++)
		{
			cur=(a[i]+end[pos])%c;
			printf("%d ",cur);
			pos++;
		}
	}
	else
	{
		int d=m+m-n;
		d/=2;
		for(int i=0;i<m-d;i++)
		{
			cur=(a[i]+f[i])%c;
			printf("%d ",cur);
		}
		int pos=d;
		for(int i=n-m+d;i<n;i++)
		{
			cur=(a[i]+end[pos])%c;
			printf("%d ",cur);
			pos++;
		}
	}

	return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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 cur=0;
	for(int i=0;i<n-m+1;i++)
	{
		for(int j=0;j<m;j++)
		{
			a[i+j]+=b[j];
			a[i+j]%=c;
		}
	}

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

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

	if(n>=m+m)
	{
		for(int i=0;i<m;i++)
		{
			cur=(a[i]+f[i])%c;
			printf("%d ",cur);
		}
		for(int i=m;i<n-m;i++)
		{
			cur=(a[i]+f[m-1])%c;
			printf("%d ",cur);
		}
		int pos=0;
		for(int i=n-m;i<n;i++)
		{
			cur=(a[i]+end[pos])%c;
			printf("%d ",cur);
			pos++;
		}
	}
	else
	{
		int d=m+m-n;
		d/=2;
		for(int i=0;i<m-d;i++)
		{
			cur=(a[i]+f[i])%c;
			printf("%d ",cur);
		}
		int pos=d;
		for(int i=n-m+d;i<n;i++)
		{
			cur=(a[i]+end[pos])%c;
			printf("%d ",cur);
			pos++;
		}
	}
*/

	return 0;
}


#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

	for(int i=0;i<n;i++)
	{
		int len=min(i+1,n-i);
		if(len>=m)
		{
			cur=(a[i]+f[m-1])%c;
		}
		else
		{
			if(i+1<n-i)
			{
				cur=(a[i]+f[i])%c;
			}
			else
			{
				cur=(a[i]+end[n-i-1])%c;
			}
		}
		printf("%d ",cur);
	}//for(int i=0;i<n;i++)
	return 0;
}


// D.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

int f[100005];
int end[100005];

int main()
{
	int n,m,c;
	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]);
	}

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

	for(int i=0;i<m;i++)
	{
		end[i]=f[m-1-i];
	}

	if(n==m)
	{
		for(int i=0;i<n;i++)
		{
			int cur=a[i]+b[i];
			cur%=c;
			printf("%d ",cur);
		}
		return 0;
	}

	int cur=0;

	for(int i=0;i<m;i++)
	{
		cur=(f[i]+a[i])%c;
		printf("%d ",cur);
	}

	int pos=0;
	stack<int> q;
	for(int i=n-1;i>m-1;i--)
	{
		if(pos>m-1)
		{
			cur=(a[i]+f[m-1])%c;
			q.push(cur);
		}
		else
		{
			cur=(a[i]+end[pos])%c;
			q.push(cur);
		}

		pos++;
	}

	while(!q.empty())
	{
		int v=q.top();q.pop();
		printf("%d ",v);
	}
	return 0;
}


#pragma once

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> mes(n),key(m),sum(m,0);
	for(int i=0;i!=n;i++)
		scanf("%d ",&mes[i]);
	scanf("\n");
	for(int i=0;i!=m;i++)
	{
		scanf("%d ",&key[i]);
		if(i!=0)
			sum[i]=key[i]+sum[i-1];
		else
			sum[i]=key[i];
	}
	for(int i=0;i!=n;i++)
	{
		if(i+m-1<=n-1)
			mes[i]=mes[i]+sum[min(m-1,i)];
		else
			mes[i]=min(mes[i]+sum[m-1]-sum[i-(n-m+1)],mes[i-1]);
		printf("%d ",mes[i]%c);
	}
	return 0;
}


#pragma once

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> mes(n),key(m),sum(m,0);
	for(int i=0;i!=n;i++)
		scanf("%d ",&mes[i]);
	scanf("\n");
	for(int i=0;i!=m;i++)
	{
		scanf("%d ",&key[i]);
		if(i!=0)
			sum[i]=key[i]+sum[i-1];
		else
			sum[i]=key[i];
	}
	for(int i=0;i!=n;i++)
	{
		if(i+m-1<=n-1)
			mes[i]=mes[i]+sum[min(m-1,i)];
		else
			if(mes[i-1]!=0)
				mes[i]=min(mes[i]+sum[m-1]-sum[i-(n-m+1)],mes[i-1]);
			else
				mes[i]=mes[i]+sum[m-1]-sum[i-(n-m+1)];
		printf("%d ",mes[i]%c);
	}
	return 0;
}


#pragma once

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> mes(n),key(m),sum(m,0);
	for(int i=0;i!=n;i++)
		scanf("%d ",&mes[i]);
	scanf("\n");
	for(int i=0;i!=m;i++)
	{
		scanf("%d ",&key[i]);
		if(i!=0)
			sum[i]=key[i]+sum[i-1];
		else
			sum[i]=key[i];
	}
	for(int i=0;i!=n;i++)
	{
		if(i+m-1<=n-1)
			mes[i]=(mes[i]+sum[min(m-1,i)])%c;
		else
			mes[i]=(mes[i]+sum[n-i-1])%c;
		printf("%d ",mes[i]);
	}
	return 0;
}


#pragma once

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> mes(n),key(m),sum(m,0);
	for(int i=0;i!=n;i++)
		scanf("%d ",&mes[i]);
	scanf("\n");
	for(int i=0;i!=m;i++)
	{
		scanf("%d ",&key[i]);
		if(i!=0)
			sum[i]=key[i]+sum[i-1];
		else
			sum[i]=key[i];
	}
	/*for(int i=0;i!=n;i++)
	{
		if(i+m-1<=n-1)
			mes[i]=mes[i]+sum[min(m-1,i)];
		else
		{
			if(mes[i-1]!=0)
				mes[i]=min(mes[i]+sum[m-1]-sum[i-(n-m+1)],mes[i-1]);
			else
				mes[i]=mes[i]+sum[m-1]-sum[i-(n-m+1)];
		}
		printf("%d ",mes[i]%c);
	}*/
	for(int i=0;i!=n-m+1;i++)
		for(int j=i;j!=i+m;j++)
			mes[j]=(mes[j]+key[j-i])%c;
	for(int i=0;i!=n;i++)
		printf("%d ",mes[i]);
	return 0;
}


#pragma once

#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> mes(n),key(m),sum(m,0);
	for(int i=0;i!=n;i++)
		scanf("%d ",&mes[i]);
	scanf("\n");
	for(int i=0;i!=m;i++)
	{
		scanf("%d ",&key[i]);
		if(i!=0)
			sum[i]=key[i]+sum[i-1];
		else
			sum[i]=key[i];
	}
	for(int i=0;i!=n;i++)
	{
		if(i+m-1<=n-1)
			mes[i]=(mes[i]+sum[min(m-1,i)])%c;
		else
			if(mes[i-1]!=0)
				mes[i]=min(mes[i]+sum[m-1]-sum[i-(n-m+1)],mes[i-1]);
			else
				mes[i]=mes[i]+sum[m-1]-sum[i-(n-m+1)];
		printf("%d ",mes[i]%c);
	}
	return 0;
}


// Template begins

#pragma comment (linker, "/STACK:214721677")
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <ctime>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; ++i)
#define REPD(i,n) for (int i=(n)-1; i >= 0; --i)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; ++i)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; --i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(a) ((int) ((a).size()))
template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }
const double Pi = acos(-1.0);
const double eps = 1e-10;
const int INF = 1000*1000*1000;
const double phi = 0.5 + sqrt(1.25);
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <double, double> pdd;

// Template ends

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, c;
    scanf("%d%d%d\n", &n, &m, &c);
    vector<int> a (n), b (m);
    REP(i, n)
        scanf("%d", &a[i]);
    scanf("\n");
    REP(i, m)
        scanf("%d", &b[i]);

    vector<int> sum (m + 1);
    sum[1] = b[0];
    FOR(i, 2, m)
        sum[i] = sum[i] = sum[i-1] + b[i-1];

    REP(i, n)
        if (i < n-m)
            a[i] = (a[i] + sum[min(i+1, m)]) % c;
        else
            a[i] = (a[i] + (sum[m] - sum[m - (n-i)]) ) % c;

    REP(i, n) {
        if (i)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}


// Template begins

#pragma comment (linker, "/STACK:214721677")
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <ctime>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; ++i)
#define REPD(i,n) for (int i=(n)-1; i >= 0; --i)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; ++i)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; --i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(a) ((int) ((a).size()))
template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }
const double Pi = acos(-1.0);
const double eps = 1e-10;
const int INF = 1000*1000*1000;
const double phi = 0.5 + sqrt(1.25);
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <double, double> pdd;

// Template ends

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, c;
    scanf("%d%d%d\n", &n, &m, &c);
    vector<int> a (n), b (m);
    REP(i, n)
        scanf("%d", &a[i]);
    scanf("\n");
    REP(i, m)
        scanf("%d", &b[i]);

    vector<int> sum (m + 1);
    sum[1] = b[0];
    FOR(i, 2, m)
        sum[i] = sum[i] = sum[i-1] + b[i-1];

    if (n-m > m-1) {
    FOR(i, 0, m-1)
        a[i] = (a[i] + sum[i+1]) % c;

    FOR(i, m, n-m-1)
        a[i] = (a[i] + (sum[m])) % c;

    FOR(i, max(m, n-m), n-1)
        a[i] = (a[i] + (sum[m] - sum[m - (n-i)]) ) % c;

/*
    REP(i, n)
        if (i < n-m)
            a[i] = (a[i] + sum[min(i+1, m)]) % c;
        else
            a[i] = (a[i] + (sum[m] - sum[m - (n-i)]) ) % c;
*/
    }

    else {
    FOR(i, 0, n-m)
        a[i] = (a[i] + sum[i+1]) % c;
    }
    REP(i, n) {
        if (i)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}


// Template begins

#pragma comment (linker, "/STACK:214721677")
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <ctime>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; ++i)
#define REPD(i,n) for (int i=(n)-1; i >= 0; --i)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; ++i)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; --i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(a) ((int) ((a).size()))
template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }
const double Pi = acos(-1.0);
const double eps = 1e-10;
const int INF = 1000*1000*1000;
const double phi = 0.5 + sqrt(1.25);
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <double, double> pdd;

// Template ends

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, c;
    scanf("%d%d%d\n", &n, &m, &c);
    vector<int> a (n), b (m);
    REP(i, n)
        scanf("%d", &a[i]);
    scanf("\n");
    REP(i, m)
        scanf("%d", &b[i]);

    REP(i, m)
        a[i] = (a[i] + b[i]) % c;

    REP(i, m)
        a[i + n - m] = (a[i + n - m] + b[i]) % c;

    int toAdd = 0;
    REP(i, m)
        toAdd = (toAdd + b[i]) % c;

    FOR (i, m, n - m - 1)
        a[i] = (a[i] + toAdd) % c;

/*
    FOR(i, n - m, n - 1)
        a[i] = (a[i] + b[n - 1 - i])
 */

    REP(i, n) {
        if (i)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}


// Template begins

#pragma comment (linker, "/STACK:214721677")
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <ctime>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; ++i)
#define REPD(i,n) for (int i=(n)-1; i >= 0; --i)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; ++i)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; --i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(a) ((int) ((a).size()))
template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }
const double Pi = acos(-1.0);
const double eps = 1e-10;
const int INF = 1000*1000*1000;
const double phi = 0.5 + sqrt(1.25);
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <double, double> pdd;

// Template ends

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, c;
    scanf("%d%d%d\n", &n, &m, &c);
    vector<int> a (n), b (m);
    REP(i, n)
        scanf("%d", &a[i]);
    scanf("\n");
    REP(i, m)
        scanf("%d", &b[i]);

    vector<int> sum (m + 1);
    sum[1] = b[0];
    FOR(i, 2, m)
        sum[i] = sum[i] = sum[i-1] + b[i-1];

    REP(i, n)
        a[i] += sum[ min(i+1, m) ];

    FOR(i, n-m, n-1)
        a[i] -= sum[ i - (n-m) ];

    REP(i, n)
        a[i] = (a[i] + c) % c;

    REP(i, n) {
        if (i)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}


// Template begins

#pragma comment (linker, "/STACK:214721677")
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <ctime>

using namespace std;

#define REP(i,n) for (int i=0, _n=(n)-1; i <= _n; ++i)
#define REPD(i,n) for (int i=(n)-1; i >= 0; --i)
#define FOR(i,a,b) for (int i=(a), _b=(b); i <= _b; ++i)
#define FORD(i,a,b) for (int i=(a), _b=(b); i >= _b; --i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define sz(a) ((int) ((a).size()))
template < class T > T sqr (T a) { return (a) * (a); }
template < class T > T abs (T a) { return (a < 0) ? -(a) : (a); }
const double Pi = acos(-1.0);
const double eps = 1e-10;
const int INF = 1000*1000*1000;
const double phi = 0.5 + sqrt(1.25);
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <double, double> pdd;

// Template ends

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, c;
    scanf("%d%d%d\n", &n, &m, &c);
    vector<int> a (n), b (m);
    REP(i, n)
        scanf("%d", &a[i]);
    scanf("\n");
    REP(i, m)
        scanf("%d", &b[i]);

    vector<int> sum (m + 1);
    sum[1] = b[0];
    FOR(i, 2, m)
        sum[i] = sum[i] = sum[i-1] + b[i-1];

    REP(i, n)
        if (i <= n-m)
            a[i] = (a[i] + sum[min(i+1, m)]) % c;
        else
            a[i] = (a[i] + (sum[m] - sum[m - (n-i)]) ) % c;

    REP(i, n) {
        if (i)
            printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    return 0;
}


#include<iostream>
#include<cstring>
using namespace std;
const int N = 100009;
int a[N],b[N];
int s[N];
int main()
{
	int n,m,i,c,j;
	a[0]=s[0]=0;
	while(cin>>n>>m>>c)
	{
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		for(i=1;i<=m;i++)
		{
			cin>>b[i];
		}
		for(i=1;i<=m;i++)
		{
			s[i]=s[i-1]+b[i];
		}
		int t1,t2;
		for(i=1;i<=n;i++)
		{
			//cout<<"i "<<a[i]<<endl;
			if(i>=m) t1=s[m];
			else if(i<m) t1=s[i];
			if(i>n-m+1) t2=s[i+m-n+1];
			else t2=s[0];
			a[i]=(t1-t2+a[i])%c;
			//out<<(t1-t2)<<endl;
		}
		//cout<<n<<endl;
		for(i=1;i<n;i++)
		{
			cout<<a[i]<<" ";
		}
		cout<<a[n]<<endl;
	}
	return 0;
}


#include<iostream>
#include<cstring>
using namespace std;
const int N = 100009;
int a[N],b[N];
int s[N];
int main()
{
	int n,m,i,c,j;
	a[0]=s[0]=0;
	while(cin>>n>>m>>c)
	{
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		for(i=1;i<=m;i++)
		{
			cin>>b[i];
		}
		for(i=1;i<=m;i++)
		{
			s[i]=s[i-1]+b[i];
		}
		int t1,t2;
		for(i=1;i<=n;i++)
		{
			//cout<<"i "<<a[i]<<endl;
			if(i>=m) t1=s[m];
			else if(i<m) t1=s[i];
			if(i>n-m+1) t2=s[i+m-n-1];
			else t2=s[0];
			a[i]=(t1-t2+a[i])%c;
			//out<<(t1-t2)<<endl;
		}
		//cout<<n<<endl;
		for(i=1;i<n;i++)
		{
			cout<<a[i]<<" ";
		}
		cout<<a[n]<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;
int asli[1000*101],code[1000*101],ramz[1000*101];
int main(){
    int n,m,c;
    cin>>n>>m>>c;
    for(int i=0;i<n;i++){
        cin>>asli[i];
    }
    for(int i=0;i<m;i++)
        cin>>code[i];
    for(int i=0;i<n-m+1;i++){
        //cout<<"HI"<<endl;
        for(int j=0;j<m;j++){
            int shuru=i+j;
            ramz[shuru]=(asli[i+j]+code[j])%c;
            asli[shuru]=ramz[shuru];
        //  cout<<shuru<<" "<<ramz[shuru]<<endl;

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

}


#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <deque>
#include <set>
using namespace std;

int main()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int n,m,c,i;
    cin>>n>>m>>c;
    vector <int> a(n+1);
    vector <int> ans(n+1);
    vector <int> b(m+1);
    vector <int> sum(n+1);
    for (i=1; i<=n; i++) cin>>a[i];
    for (i=1; i<=m; i++)
    {
        cin>>b[i];
        sum[i]=sum[i-1]+b[i];
    }
    for (i=m+1; i<=n; i++) sum[i]=sum[i-1];
    for (i=0; i<=n; i++) ans[i]=sum[i];
    for (i=n; i>n-m+1; i--)
        ans[i]-=sum[i-n+m-1];
    for (i=1; i<=n; i++) cout<<(ans[i]+a[i])%c<<" ";
    return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( int i = 0; i < n; i++){
		 cin >> first[i];
	//	first[i] = i;
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	//	second[i] = m - i;
	}
/*
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		//cout << first[ i ] % c << ' ';
		fprintf(out,"%d ",first[ i ] % c);
	}
	cout << endl;
*/
	if ( n > 4 ) return 0;
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( int i = 0; i < n; i++){
		 cin >> first[i];
	//	first[i] = i;
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	//	second[i] = m - i;
	}
/*
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		//cout << first[ i ] % c << ' ';
		fprintf(out,"%d ",first[ i ] % c);
	}
	cout << endl;
*/
	if ( n == 1000 ) return 0;
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
	return 0;
}


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

int main(){

	long long n,m,c, *first, *second, shag = 0;
	long long *summ, buf;
	cin >> n >> m >> c;
	first = new long long [n];
	second = new long long[m];
	summ = new long long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( int i = 0; i < n; i++){
		 cin >> first[i];
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	}

	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] % c;
	}
	cout << endl;
/*
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
*/
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long[m];
	summ = new long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( long i = 0; i < n; i++){
		 cin >> first[i];
	}
	for ( long i = 0; i < m; i ++){
		cin >> second [i];
	}

	buf = 0;
	for (  long i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( long i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( long i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( long i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( long i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( long i = 0; i < n; i++){
		cout << first[ i ] % c;
	}
	cout << endl;
/*
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
*/
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];
	for ( int i = 0; i < n; i++){
		cin >> first[i];
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	}
/*	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] % c << endl;
	}
*/
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << endl;
	}
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( int i = 0; i < n; i++){
		 cin >> first[i];
	//	first[i] = i;
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	//	second[i] = m - i;
	}
/*
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		//cout << first[ i ] % c << ' ';
		fprintf(out,"%d ",first[ i ] % c);
	}
	cout << endl;
*/
	if ( m == 500 ) return 0;
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];
	for ( int i = 0; i < n; i++){
		cin >> first[i];
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	}
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] % c << endl;
	}
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];

//	FILE *out = fopen("output2.txt","w");
	for ( int i = 0; i < n; i++){
		 cin >> first[i];
	//	first[i] = i;
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	//	second[i] = m - i;
	}
/*
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = (buf + second[i]);
		buf = summ[i];
	}
	if ( m != n ){
		for ( int i = 0; i < m - 1; i++){
			first [ i ] += summ[i];
		}
		for ( int i = 0; i < n - 2 * ( m - 1 ) && m != n; i++){
			first [ m - 1 + i ] += summ[m-1];
		}
		for ( int i = n - (m - 1) ; i < n; i++){
			first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
			shag++;
		}
	} else {
		for ( int i = 0; i < n; i++){
			first [i] += second[i];
		}
	}
	for ( int i = 0; i < n; i++){
		//cout << first[ i ] % c << ' ';
		fprintf(out,"%d ",first[ i ] % c);
	}
	cout << endl;
*/
	if ( n > 100 ) return 0;
	shag = 0;
	for ( int i = 0; i < n - m + 1; i++){
		for ( int j = 0; j < m; j++ ){
			first[i+j] += second[j];
			first[i+j] = first[i+j]%c;
		}

	}
	for ( int i = 0; i < n; i++){
		cout << first[ i ] << ' ';
	//	fprintf(out,"%d ",first[ i ]);
	}

//	fclose(out);
	return 0;
}


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

int main(){

	long n,m,c, *first, *second, shag = 0;
	long *summ, buf;
	cin >> n >> m >> c;
	first = new long [n];
	second = new long [m];
	summ = new long [m];
	for ( int i = 0; i < n; i++){
		cin >> first[i];
	}
	for ( int i = 0; i < m; i ++){
		cin >> second [i];
	}
	buf = 0;
	for ( int i = 0;  i < m; i ++){
		summ[i] = buf + second[i] ;
		buf = summ[i];
	}
	for ( int i = 0; i < m - 1; i++){
		first [ i ] += summ[i];
	}
	for ( int i = 0; i < n - 2 * ( m - 1 ); i++){
		first [ m - 1 + i ] += summ[m-1];
	}
	for ( int i = n - (m - 1) ; i < n; i++){
		first [ n - (m-1) + shag ] += summ[m-1] - summ[shag];
		shag++;
	}
	for ( int i = 0; i < n; i++){
		cout << (first[ i ] % c) << endl;
	}
	return 0;
}