#include<bits/stdc++.h> usingnamespace std; using ll = longlong;
intmain(){ int t; cin >> t;
while (t--) { int n; cin >> n;
vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; }
int cnt = 0, sum = 0; for (int i = 0; i < n; i++) { if (a[i] < b[i]) { cnt++; sum += b[i] - a[i]; a[i] = b[i] + sum; } } for (int i = 0; i < n; i++) { if (a[i] - sum < b[i]) { cnt = 2; } }
#include<bits/stdc++.h> usingnamespace std; using ll = longlong;
intmain(){ int t; cin >> t;
while (t--) { int n, m; cin >> n >> m;
string s; cin >> s;
vector a(n, vector<ll>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } }
int x = 0, y = 0; for (auto c : s) { ll sum = 0; if (c == 'D') { for (int i = 0; i < m; i++) { sum += a[x][i]; } a[x][y] = -sum; x++; } else { for (int i = 0; i < n; i++) { sum += a[i][y]; } a[x][y] = -sum; y++; } }
ll sum = 0; for (int i = 0; i < m; i++) { sum += a[n - 1][i]; } a[n - 1][m - 1] = -sum;
for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cout << a[i][j] << " "; } cout << endl; } }