//
// Created by yamunaku on 2021/03/07.
//

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

void solve() {
    int n;
    cin >> n;
    vector<string> s(3);
    rep(i, 3) cin >> s[i];
    cout << "1" + string(n, '0') + string(n, '1') << endl;
}

int main() {
    //CFS;
    int t;
    cin >> t;
    rep(_, t) solve();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pp pop_back
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f0(i,a,n) for(i=a;i<n;i++)
#define f1(i,a,b) for(i=a;i<=b;i++)
#define all(v) sort(v.begin(),v.end());
#define stp setprecision
#define nl endl
#define I insert
#define ipt(a,n) for(i=0;i<n;i++)cin>>a[i];
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vl vector<ll>
#define mp map<ll,ll>
#define sr(a,n) sort(a,a+n);
#define cx(x) cout<<x<<"\n";
#define cy(x) cout<<x<<" ";
#define cn cout<<"No\n";
#define cw cout<<"Yes\n";
#define bs binary_search
#define S second
#define F first
#define pi 3.141592653589793238
#define ct cout<<
ll sieve[1000001];
void prime()
{
    ll i,j;
    sieve[0]=0,sieve[1]=0;
    for(i=2;i<=1e6;i++)
        sieve[i]=1;
    for(i=2;i<=1e6;i++)
    {
        if(sieve[i]==1)
        {
            for(j=2*i;j<=1e6;j+=i)
                sieve[j]=0;
        }
    }
}
ll be(ll a,ll b,ll m)
{
    ll r=1;
    while(b!=0)
    {
        if(b&1)
            r=(r*a)%m;
        a=(a*a)%m;
        b=b/2;
    }
    return r;
}
int main()
{
    fast;
    prime();
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,s,d,i;
        cin>>n>>s>>d;
        ll x[n],y[n],ans=0,k=0;
        f0(i,0,n)
        {
            cin>>x[i]>>y[i];
            k=0;
            if(x[i]<s&&y[i]>d)
            {
                ans=1,k=1;
            }
            //cx(k)
        }
        if(ans)
            cw
        else
            cn
    }
}


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

const int MAXN = 2e5;
vector<int> adj[MAXN];
int par[MAXN];
int nbSommets;
int id[MAXN];
bool onPath[MAXN];
int cnt;

int getFurthest(int source) {
  vector<int> dis(nbSommets, -1);
  dis[source] = 0;
  queue<int> q;
  q.push(source);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : adj[u])
      if (dis[v] == -1) {
        dis[v] = dis[u] + 1;
        par[v] = u;
        q.push(v);
      }
  }
  int sol = 0;
  for (int i(0); i < nbSommets; ++i)
    if (dis[i] > dis[sol])
      sol = i;
  return sol;
}

void dfs(int u, int p) {
  id[u] = ++cnt;
  for (auto v : adj[u])
    if (v != p and !onPath[v])
      dfs(v, u);
  for (auto v : adj[u])
    if (v != p and onPath[v])
      dfs(v, u);
  ++cnt;
}

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

  cin >> nbSommets;
  for (int i = 0; i < nbSommets - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  int s = getFurthest(0);
  int t = getFurthest(s);
  while (1) {
    onPath[t] = true;
    if (t == s)
      break;
    t = par[t];
  }
  dfs(s, s);
  for (int i = 0; i < nbSommets; ++i) {
    cout << id[i] << ' ';
  }
  cout << endl;
}

#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define maxm 600005
#define maxn 200005
#define ls (tot << 1)
#define rs (tot << 1 | 1)
#define PII pair<int, int>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const double pi = acos(-1);
const ll mod = 1e9 + 7;
const double eps = 1e-10;
inline ll read(){
    ll x = 0, f = 1;char ch = getchar();
    while(ch > '9' || ch < '0'){if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x * 10 + ch -'0';ch = getchar();}
    return x * f;
}
int n, st, en, dep[maxn], inde[maxn], fa[maxn][20], tot, D[maxn];
struct p{
	int u, v, nxt;
}e[maxn * 2];
void add(int u, int v){e[++tot] = p{u, v, inde[u]}, inde[u] = tot;}
void dfs(int u, int f){
	dep[u] = dep[f] + 1;
	fa[u][0] = f;
	for(int i = 1;i < 20;i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
	if(dep[u] > dep[st]) st = u;
	for(int i = inde[u];i;i = e[i].nxt){
		int v = e[i].v;
		if(v == f) continue;
		dfs(v, u);
	}
}
int lca(int u, int v){
	if(dep[u] < dep[v]) swap(u, v);
	int t = dep[u] - dep[v];
	for(int i = 19;i >= 0;i--){
		if(t & (1 << i)) u = fa[u][i];
	}
	for(int i = 19;i >= 0;i--){
		if(fa[u][i] != fa[v][i])
			u = fa[u][i], v = fa[v][i];
	}
	if(u == v) return u;
	return fa[u][0];
}
int dfn[maxn], dfs_clock;
int s[maxn], tp;
ll E[maxn];
void dfs2(int u, int f){
	dfn[u] = ++dfs_clock;
	bool F = 0;
	for(int i = inde[u];i;i = e[i].nxt){
		int v = e[i].v;
		if(v == f) continue;
		F = 1;
		dfs2(v, u);
	}
	if(!F) s[++tp] = u;
}
bool cmp(int a, int b){return D[a] < D[b] || (D[a] == D[b] && dfn[a] < dfn[b]);}
int dis(int u, int v){
	return dep[u] + dep[v] - 2 * dep[lca(u, v)];
}
void gfind(int x, ll v){
	if(E[x]) return;
	E[x] = v;
	gfind(fa[x][0], v - 1);
}
bool onzj[maxn];
int getD(int u){
	for(int i = 19;i >= 0;i--){
		if(!onzj[fa[u][i]]) u = fa[u][i];
	}
	return dep[u];
}
int main(){
	n = read();
	for(int i = 1;i < n;i++){
		int u = read(), v = read();
		add(u, v), add(v, u);
	}
	dfs(1, 0);
	en = st;st = 0;
	dfs(en, 0);
	swap(st, en);
	onzj[st] = onzj[0] = 1;
	for(int i = en;i != st;i = fa[i][0]) onzj[i] = 1;
	dfs2(st, 0);
	for(int i = 1;i <= tp;i++){
		if(s[i] == en) D[s[i]] = inf;
		else{
			D[s[i]] = getD(s[i]);
		}
	}
	sort(s + 1, s + tp + 1, cmp);
	s[0] = st;
	E[st] = 1;
	for(int i = 1;i <= tp;i++){
		E[s[i]] = E[s[i - 1]] + dis(s[i], s[i - 1]);
	}
	for(int i = 1;i <= tp;i++){
		gfind(fa[s[i]][0], E[s[i]] - 1);
	}
	for(int i = 1;i <= n;i++) printf("%lld ", E[i]);
	return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin>>N;
    ll m=1000;
    ll ans=0;
    while(m<=N){
        ans+=N-m+1;
        m*=1000;
    }
    cout<<ans<<"\n";
    return 0;
}

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

int main(void) {
    ll N;
    ll K;
    cin >> N >> K;
    int append = 0;
    while (K-- > 0) {
        if (N % 200 == 0) {
            N /= 200;
        } else if (append) {
            N = (N/200.0) * 1000 + 1;
            append = 0;
        } else {
            append = 1;
        }
    }
    if (append) cout << N << 200 << endl;
    else cout << N << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vp = vector<P>;
using vs = vector<string>;
using vb = vector<bool>;
using pq = priority_queue<int,vector<int>,greater<int>>;/*top()で最小値取得*/
using pq2 = priority_queue<int, vector<int>, less<int>>;/*top()で最大値取得*/

#define INF 1000000005
#define mod 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i = 0; i < (n); ++i) /*0からn-1までのrep*/
#define rrep(i,n) for(int i = 1; i <= (n); ++i) /*1からnまでのrep*/
#define drep(i,n) for(int i = (n)-1; i >= 0; --i) /*n-1から0までのrep*/
#define srep(i,s,t) for (int i = s; i < t; ++i) /*sからt-1までのrep*/
#define each(a,b) for(auto& (a): (b)) /*よくわからん*/
#define all(v) (v).begin(),(v).end() /*全選択*/
#define sz(v) (int)(v).size() /*大きさ*/
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end()) /*重複削除*/
#define cmx(x,y) x=max(x,y) /*最大値*/
#define cmn(x,y) x=min(x,y) /*最小値*/
#define fi first
#define se second
#define pb push_back //a.push_back(最後に任意の数字を追加); a.pop_back();
#define rev(v) reverse((v).begin(),(v).end());
#define sob(v) sort((v).begin(), (v).end(),greater<int>()); /*大きい順にソート*/
#define so(v) sort((v).begin(), (v).end()); /*小さい順にソート*/
#define yn {puts("Yes");}else{puts("No");}
#define dame { puts("-1"); return 0;}/*だめ*/
const double eps = 1e-10;
const ll MOD = 1000000007;
constexpr ll MAX = 5000000;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

ll divup(ll x, ll y){
	if(x%y==0){
		return x/y;
	} else {
		return x/y + 1;
	}
}

int main(){
	int x,y;
	cin >> x >> y;
	if(abs(x-y)>=3){
		cout<<"No"<<endl;
	} else {
		cout<<"Yes"<<endl;
	}
	return 0;
}

#include<bits/stdc++.h>
#define maxn 1000005
#define inf 9999999999999999
#define mod 1000000007
typedef long long LL;
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    //freopen("bwxnQAQin.txt","r",stdin);
    LL x,y;
    cin>>x>>y;
    if(abs(x-y)<3)cout<<"Yes";
    else cout<<"No";
    return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)

typedef long long ll;
const ll INF = (1LL << 62) - (1LL << 31); /*オーバーフローしない程度に大きい数*/
// const ll MOD = 1000000007;
using namespace std;

struct UnionFind {
    vector<int> par, siz;

    UnionFind(int n) : par(n, -1), siz(n, 1) {}

    int root(int x) {
        if (par[x] == -1)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool unite(int x, int y) {
        // x,yを根まで移動する
        x = root(x);
        y = root(y);
        // すでに同じグループのときは何もしない
        if (x == y) return false;
        /// union by size (y側のサイズが小さくなるようにする)
        if (siz[x] < siz[y]) swap(x, y);
        // yをxの子とする
        par[y] = x;
        siz[x] += siz[y];
        return true;
    }

    // xを含むグループのサイズ
    int size(int x) {
        int ret = siz[root(x)];
        return ret;
    }
};

// 辺を表す型，ここでは重みを表す型を long long 型とする
struct Edge {
    int to;       // 隣接頂点番号
    long long w;  // 重み
    Edge(int to, long long w) : to(to), w(w) {}
};

// 重み付きグラフを表す型
using Graph = vector<vector<Edge>>;

// 緩和を実施する関数
template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else
        return false;
}

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
// int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
// int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    return 0;
}

using P = pair<ll, ll>;

int mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
#ifdef LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    // reverse(s.begin(), s.end());

    int now = 1;
    ll ans = 1;

    vector<vector<ll>> dp(n + 1, vector<ll>(2, 0));
    dp[0][0] = 1;
    dp[0][1] = 1;

    rep(i, n) {
        if (s[i] == "AND") {
            dp[i + 1][0] = dp[i][0] * 2 + dp[i][1];
            dp[i + 1][1] = dp[i][1];
        } else {
            dp[i + 1][0] = dp[i][0];
            dp[i + 1][1] = dp[i][0] + dp[i][1] * 2;
        }
    }

    cout << dp[n][1];

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template<typename T> struct fenwickTree {
    int n;
    vector<int> tree;
    fenwickTree(int n_ = 0) : n(n_) { tree.resize(n_ + 1, 0); }
    int lowbit(int x) { return x & (-x); }
    int size() { return n; }
    void add(int pos, int x) { // pos位置加上x
        for (; pos <= n; pos += lowbit(pos)) {
            tree[pos] += x;
        }
    }
    T query(int pos) { // 查询pos位置的前缀和 即a[1] + a[2] + ... + a[pos]
        T res = 0;
        for (; pos > 0; pos -= lowbit(pos)) {
            res += tree[pos];
        }
        return res;
    }
    T sum(int l, int r) { // [l, r]区间查询
        return query(r) - query(l - 1);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n + n), pos(n + n), col(n + n);
    iota(pos.begin(), pos.end(), 0);
    for (int i = 0; i < n + n; i++) {
        cin >> a[i];
    }
    sort(pos.begin(), pos.end(), [&](int i, int j) {
        return a[i] < a[j];
    });
    for (int i = 0; i < n + n; i++) {
        col[pos[i]] = (i < n);
    }
    vector<int> stk;
    string res(n + n, ' ');
    for (int i = 0; i < n + n; i++) {
        if (stk.empty()) {
            stk.push_back(i);
        } else {
            if (col[stk.back()] != col[i]) {
                res[stk.back()] = '(';
                stk.pop_back();
                res[i] = ')';
            } else {
                stk.push_back(i);
            }
        }
    }
    cout << res << "\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r)-1; i >= (int)(l); (i) -= 1)
template <typename T1, typename T2> inline void chmax(T1 &a, T2 b) { a = (a > b ? a : b); }
template <typename T1, typename T2> inline void chmin(T1 &a, T2 b) { a = (a < b ? a : b); }
template <typename T1, typename T2> ostream &operator<<(ostream &os,const pair<T1,T2> &p) { os<<p.first<<' '<<p.second; return os;}
template <typename T> ostream &operator<<(ostream &os,const vector<T> &v) { range(i,0,v.size()) {os<<(i?" ":"")<<v[i];} return os;}
using ull = unsigned long long;
using ll = long long;
using PL = pair<ll, ll>;
using P = pair<int, int>;
const ll INF64 = INT64_MAX / 2;
const int INF32 = INT32_MAX / 2;
const char newl = '\n';

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

  int t;
  cin>>t;

  while(t--){
    int n;
    cin>>n;
    range(i,0,3){
      string s;
      cin>>s;
    }
    cout<<string(n,'1')+string(n,'0')+"1"<<newl;
  }
}

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long long ll;
#define G getchar()
int read()
{
	int x=0; bool flg=false; char ch=G;
	for (;!isdigit(ch);ch=G) if (ch=='-') flg=true;
	for (;isdigit(ch);ch=G) x=(x<<3)+(x<<1)+(ch^48);
	return flg?-x:x;
}
#undef G
#define fi first
#define se second
/*
const int mod=;
inline int upd(const int &x){return x+(x>>31&mod);}
inline void add(int &x,const int &y){x=upd(x+y-mod);}
inline void iadd(int &x,const int &y){x=upd(x-y);}
int qpow(int x,int y){
	int res=1;
	for (;y;y>>=1,x=1LL*x*x%mod)
		if (y&1) res=1LL*res*x%mod;
	return res;
}
*/
//typedef pair<int,int> P;
#define rep(i,l,r) for (int i(l);i<=int(r);i++)
#define per(i,l,r) for (int i(r);i>=int(l);i--)
#define all(x) (x).begin(),(x).end()

int n;
char s[200010],t[200010],r[200010];
void solve(){
	scanf("%d%s%s%s",&n,s+1,t+1,r+1);
	n<<=1; int m=n>>1;
	static bool b[2][2];
	memset(b,0,sizeof b);
	b[s[1]^48][s[n]^48]=1;
	b[t[1]^48][t[n]^48]=1;
	b[r[1]^48][r[n]^48]=1;
	if (b[0][0]&&b[1][1]){
		if (b[1][0]){
			putchar(49);
			rep(T,1,m) putchar(48);
			rep(T,1,m) putchar(49);
			puts("");
		}
		else{
			rep(T,1,m) putchar(49);
			rep(T,1,m) putchar(48);
			putchar(49);
			puts("");
		}
	}
	else if (b[1][1]){
		rep(T,1,m) putchar(48);
		putchar(49);
		rep(T,1,m) putchar(48);
		puts("");
	}
	else{
		rep(T,1,m) putchar(49);
		putchar(48);
		rep(T,1,m) putchar(49);
		puts("");
	}
}
int main()
{
	for (int T=read();T--;) solve();
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef long long ll;
int a,b;ll k,c[66][66];
int main(){
	cin>>a>>b>>k;
	rep(i,0,a+b){
		c[i][0]=1;
		rep(j,1,i)c[i][j]=c[i-1][j-1]+c[i-1][j];
	}
	int s=a+b;
	rep(i,1,s){
		if(!a)putchar('b'),b--;
		else if(!b)putchar('a'),a--;
		else{
			ll l=c[s-i][a-1];
			if(l>=k)a--,putchar('a');
			else k-=l,b--,putchar('b');
		}
	}
	putchar('\n');
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int num1, num2, num3;
    int n = 2, m = 2;
    int matrix[n][m];
for (int i = 0; i < n; ++i) {
  for (int j = 0; j < m; ++j) {
    cin >> matrix[i][j];
  }
}
    num1 = matrix[0][0] * matrix[1][1];
    num2 = matrix[0][1] * matrix[1][0];
    num3 = num1 - num2;
    cout << num3;

    return 0;

}


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

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

  ll B; cin >> B;
  ll C; cin >> C;

  ll ans = 0;
  if (C == 1) {
    if (B == 0) ans = 1;
    else ans = 2;
    cout << ans << '\n';
    return 0;
  }

  if (B > 0) {
    bool zero = false;
    ll pr = B + (C - 2) / 2;
    ll pl = B - C / 2;
    if (pl <= 0) zero = true;
    pl = max(pl - 1, 0ll);
    ans += (pr - pl);

    ll nr = B + (C - 1) / 2;
    ll nl = B - (C - 1) / 2;
    if (nl <= 0) zero = true;
    nl = max(nl - 1, 0ll);
    ans += (nr - nl);
    if (zero) ans++;
  } else if (B < 0) {
    bool zero = false;
    B = -B;
    ll pr = B + (C - 1) / 2;
    ll pl = B - (C - 1) / 2;
    if (pl <= 0) zero = true;
    pl = max(pl - 1, 0ll);
    ans += (pr - pl);

    ll nr = B + C / 2;
    ll nl = B - (C - 2) / 2;
    if (nl <= 0) zero = true;
    nl = max(nl - 1, 0ll);
    ans += (nr - nl);
    if (zero) ans++;
  } else {
    ll nr = C / 2;
    ll pr = (C - 1) / 2;
    ans = nr + pr + 1;
  }
  cout << ans << '\n';
  return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define rrep1(i, n) for (int i = n; i >= 1; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define eb emplace_back
#define fi first
#define se second
#define sz(x) (int)(x).size()
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
typedef long long int ll;
typedef pair<int, int> P;
// typedef modint1000000007 mint;

void speedUpIO() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
}

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/*--------------------------------------------------*/
const int INF = 1e9;
const ll LINF = 1e18;
const int MAX = 100010;

void solve() {
    int h, w;
    cin >> h >> w;
    VV<int> G(h + 1, V<int>(w + 1));
    rep(i, h) rep(j, w) {
        char c;
        cin >> c;
        G[i][j] = c == '+' ? 1 : -1;
    }
    VV<int> dp(h + 1, V<int>(w + 1, INF));
    dp[h - 1][w - 1] = 0;
    rrep(i, h) rrep(j, w) {
        if (i == h - 1 && j == w - 1) continue;
        dp[i][j] = G[i + 1][j] - dp[i + 1][j];
        chmax(dp[i][j], G[i][j + 1] - dp[i][j + 1]);
    }
    string ans = "Draw";
    if (dp[0][0] > 0) ans = "Takahashi";
    if (dp[0][0] < 0) ans = "Aoki";
    cout << ans << "\n";
}

int main() {
    speedUpIO();
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        // cout << solve() << "\n";
        // cout << (solve() ? "Yes" : "No") << "\n";
        // cout << fixed << setprecision(15) << solve() << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n; cin >> n;
  vector<int> ans;
  for(int d = 1; d * d <= n; ++d) {
    if(n % d == 0 && d * d == n) {
      ans.emplace_back(d);
      //ans.emplace_back(n / d);
    } else if(n % d == 0) {
      ans.emplace_back(d);
      ans.emplace_back(n / d);
    }
  }
  sort(ans.begin(), ans.end());
  for(int i : ans) {
    cout << i << "\n";
  }
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double rslt=n*1.08;
    rslt=(int)rslt;
    if(rslt<206)cout<<"Yay!"<<endl;
    else if(rslt==206)cout<<"so-so"<<endl;
    else
    {
        cout<<":("<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int main() {

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

    vector<int> A(N);
    vector<int> B(M);
    rep(i,0,N) cin >> A.at(i);
    rep(i,0,M) cin >> B.at(i);

    map<int, int> mp;

    rep(i,0,1000){
        mp[i+1] = 0;
        auto itrA = find(all(A), i+1);
        if(itrA != A.end()){
            mp[i+1]++;
        }

        auto itrB = find(all(B), i+1);
        if(itrB != B.end()){
            mp[i+1]++;
        }

        if(mp[i+1]==1){
            cout << i+1 << ' ';
        }
    }

    cout << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n,tn,a[110][210],dp[210][210];
long long check(int x){
	long long k = 0,tx=x;
	while(tx){
		k++;
		tx/=10;
	}
	return x*pow(10,k);
}
int main(){
	cin >> n;
	int m=0;
	tn = n;
	while(tn){
		m++;
		tn/=10;
	}
	m/=2;
	for(int i=1;i<=pow(10,m+1);i++){
		if(i+check(i)>n){
			break;
		}
		tn = i;
	}
	cout << tn;
	return 0;
}

#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll N;
    cin >> N;
    for(ll i = 1; ; i++) if(stoll(to_string(i) + to_string(i)) > N){
        cout << i - 1 << endl;
        return 0;
    }
}


#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define X first
#define Y second
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a)
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f3f;
ll dp[N][3], pos[N][3];
pii a[N];
map<int, int> num, l, r;

int main()
{
	IOS;
	int _;
	// cin>>_;
	_ = 1;
	while(_--)
	{
		ll n;
		cin>>n;
		rep1(i, n)
		{
			cin>>a[i].X>>a[i].Y;
			num[a[i].Y] = 1;
		}
		sort(a+1, a+1+n);
		rep1(i, n)
		{
			if(!l[a[i].Y])
				l[a[i].Y] = a[i].X;
			r[a[i].Y] = a[i].X;
		}
		int cnt = 1;
		for(auto it : num)
		{
			int x = it.X;
			// cout<<x<<' '<<l[x]<<' '<<r[x]<<nl;
			if(l[x] == r[x])
			{
				dp[cnt][0] = dp[cnt][1] = min(dp[cnt-1][0]+abs(pos[cnt-1][0]-l[x]), dp[cnt-1][1]+abs(pos[cnt-1][1]-l[x]));
				pos[cnt][0] = pos[cnt][1] = l[x];
			}
			else
			{
				dp[cnt][0] = min(dp[cnt-1][0]+abs(pos[cnt-1][0]-l[x])+r[x]-l[x], dp[cnt-1][1]+abs(pos[cnt-1][1]-l[x])+r[x]-l[x]);
				dp[cnt][1] = min(dp[cnt-1][0]+abs(pos[cnt-1][0]-r[x])+r[x]-l[x], dp[cnt-1][1]+abs(pos[cnt-1][1]-r[x])+r[x]-l[x]);
				pos[cnt][0] = r[x];
				pos[cnt][1] = l[x];
			}
			cnt++;
		}
		// rep1(i, cnt)
		// 	cout<<dp[i][0]<<' '<<dp[i][1]<<nl;
		dp[cnt][0] = dp[cnt-1][0]+abs(pos[cnt-1][0]);
		dp[cnt][1] = dp[cnt-1][1]+abs(pos[cnt-1][1]);
		cout<<min(dp[cnt][0], dp[cnt][1])<<nl;
		// cout<<lower_bound(dp+1, dp+1+n, inf) - dp - 1<<endl;

	}

	AC;
}

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

int main(){

  ios::sync_with_stdio(0); cin.tie(0);

  int n, q;
  cin >> n >> q;
  vector<int> p(n), sz(n, 1);
  vector<map<int,int>> info(n);
  iota(p.begin(), p.end(), 0);
  for (int i = 0; i < n; ++i){
    int x; cin >> x;
    info[i][x]++;
  }
  function<int(int)> get = [&](int x){
    if (x == p[x]) return x;
    return p[x] = get(p[x]);
  };
  auto unite = [&](int x, int y){
    x = get(x);
    y = get(y);
    if (x != y){
      if (sz[x] < sz[y]) swap(x, y);
      p[y] = x;
      for (auto it : info[y]){
        info[x][it.first] += it.second;
      }
      sz[x] += sz[y];
    }
  };
  while (q--){
    int ex; cin >> ex;
    if (ex == 1){
      int a, b;
      cin >> a >> b;
      --a, --b;
      unite(a, b);
    }
    else {
      int a, x;
      cin >> a >> x;
      --a;
      cout << info[get(a)][x] << '\n';
    }
  }

  return 0;

}


#include <bits/stdc++.h>
#define INF 1e9
#define eps 1e-6
typedef long long ll;
using namespace std;

struct P{
	ll a, b;
}p[200010];
int n;
ll now, las;

bool cmp(P x, P y){
	return x.a + 2 * x.b > y.a + 2 * y.b;
}

int main(){

	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> p[i].b >> p[i].a;
	sort(p + 1, p + n + 1, cmp);
	for(int i = 1; i <= n; i++)
		las += p[i].b;
	if(now > las){
		puts("0");
		return 0;
	}
	for(int i = 1; i <= n; i++){
		now += p[i].b + p[i].a, las -= p[i].b;
		if(now > las){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t n, takahashi=0, aoki=0, count=0;
  cin >> n;
  priority_queue<int64_t> q;
  for(int i=0; i<n; i++){
    int64_t a, b;
    cin >> a >> b;
    aoki += a;
    q.push(2*a+b);
  }
  while(takahashi<=aoki){
    takahashi += q.top();//-q.top().second;
    //aoki -= q.top().second;
    q.pop();
    count++;
  }
  cout << count << endl;
}


#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200010,P=998244353;
int n;
long long ans,a[N],clc;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",a+i);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		ans=(ans+a[i]*(a[i]+clc))%P;
		clc=((clc<<1)+a[i])%P;
	}
	printf("%lld",ans);
	return 0;
}

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define popcount(v) __builtin_popcount(v)
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=(ll)1<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

int main(){
    INT(n);
    vector<ll> a(n);
    in(a);
    vector<vector<int>> dp(200);
    int to;
    for(int i=0;i<n;i++){
        for(int j=0;j<200;j++){
            if(dp[j].size()==0)continue;
            if(dp[j][dp[j].size()-1]==i+1)continue;
            to=(j+a[i])%200;
            if(dp[j].size()>=1&&dp[to].size()>=1){
                out("Yes");
                out(dp[(j+a[i])%200].size(),dp[(j+a[i])%200]);
                dp[j].push_back(i+1);
                out(dp[j].size(),dp[j]);
                return 0;
            }
            if(dp[j].size()>=1){
                dp[to]=dp[j];
                dp[to].push_back(i+1);
            }
        }
        if(dp[a[i]%200].size()>=1){
            out("Yes");
            out(dp[a[i]%200].size(),dp[a[i]%200]);
            out(1,i+1);
            return 0;
        }
        dp[a[i]%200].push_back(i+1);
    }
    out("No");
}


#include<bits/stdc++.h>
#define print(x) cout << (#x) << ": " << (x) << endl
#define p1d(x) cout << (#x) << ": ["; for(auto& zz: x) cout << zz << " "; cout << "]\n"
#define p2d(x) cout << (#x) << ": \n["; for(auto& vec: x) {for(auto& v: vec) cout << v << " "; cout << ",\n";}
#define p2s(x) cout << (#x) << ": ["; for(auto& vec: x) {cout << vec << ",\n";}
#define pb push_back
#define endl "\n"
// __builtin_popcount

typedef long long ll;
using namespace std;
int static fast = [](){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int main() {
    int n;
    string s, x;
    cin >> n >> s >> x;
    vector<vector<int>> dp(n+1, vector<int>(7, -1));
    auto dfs = [&] (auto& self, int d, int rem) -> int {
        if (dp[d][rem] != -1) return dp[d][rem];
        int nxt[2] = {(rem * 10 + (s[d]-'0')) % 7, (rem * 10) % 7};
        if (d == n-1) {
            if (x[d] == 'T') {
                if (nxt[0] == 0 || nxt[1] == 0) return 1;
                return 0;
            } else {
                if (nxt[0] != 0 || nxt[1] != 0) return 1;
                return 0;
            }
        }
        int res = 0;
        if (x[d] == x[d+1]) {
            if (x[d] == 'T') {
                if (self(self, d+1, nxt[0]) == 1 || self(self, d+1, nxt[1]) == 1)
                    res = 1;
            } else {
                if (self(self, d+1, nxt[0]) == 1 || self(self, d+1, nxt[1]) == 1)
                    res = 1;
            }
        } else {
            if (x[d] == 'T') {
                if (self(self, d+1, nxt[0]) == 0 || self(self, d+1, nxt[1]) == 0)
                    res = 1;
            } else {
                if (self(self, d+1, nxt[0]) == 0 || self(self, d+1, nxt[1]) == 0)
                    res = 1;
            }
        }
        dp[d][rem] = res;
        return res;
    };
    if (dfs(dfs, 0, 0) == 1) {
        cout << ((x[0] == 'T') ? "Takahashi" : "Aoki") << endl;
    } else {
        cout << ((x[0] == 'A') ? "Takahashi" : "Aoki") << endl;
    }

    return 0;
}

//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators
//do not forget to change the sizes of arrays and value of contants and other things after debugging

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)

#define SZ(x)  (ll)(x.size())

//comment the below if not required

/*

#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/

#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

const ll N = 2e5+2;

char a[N],b[N];

ll n,i,j,dp[N][7],val,temp1,temp2;

int main()
{

	IOS;

	cin>>n;

	for(i=1;i<=n;++i)
			cin>>a[i];

	for(i=1;i<=n;++i)
			cin>>b[i];

	dp[n+1][0]=1;

	for(i=n;i>=1;--i)
	{
		val = a[i]-'0';

		for(j=0;j<7;++j)
		{
			temp1 = (j*10+val)%7;
			temp2 = (j*10)%7;

			if(b[i]=='T')
			{
				if(dp[i+1][temp1] || dp[i+1][temp2])
					dp[i][j]=1;
			}
			else
			{
				if(dp[i+1][temp1] && dp[i+1][temp2])
					dp[i][j]=1;
			}

		}

	}

	if(dp[1][0]==1)
		cout<<"Takahashi\n";
	else
		cout<<"Aoki\n";

	return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define srep(i, s, n) for (int i = s; i < (n); ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using T3 = tuple<int, int, int>;
template<typename T>void print(vector<T> a) { for (T t : a) { cout << t << " "; } cout << endl; }
template<typename T>void print2(T a, T b) { cout << a << " " << b << endl; }
const ll LINF = 1LL << 60;
const int INF = 1001001001;
const int mod = 1e9 + 7;

int main() {
    int n, q;
    cin >> n;

    ll s = 0;
    ll l = -LINF, r = LINF;
    rep(i, n) {
        ll a, t;
        cin >> a >> t;
        if (t == 1) {           // +
            s += a;
            l += a;
            r += a;
        } else if (t == 2) {    // max
            l = max(l, a);
            r = max(r, a);
        } else {                // min
            l = min(l, a);
            r = min(r, a);
        }
    }
    cin >> q;
    rep(iq, q) {
        ll x;
        cin >> x;
        ll ans = x + s;
        if (ans < l) { ans = l; }
        if (ans > r) { ans = r; }
        cout << ans << endl;
    }
    return 0;
}

#include "bits/stdc++.h"
using namespace std;
#define f                   first
#define s                   second
#define pb                  push_back
#define ll                  long long
#define ld                  long double
#define lb                  lower_bound
#define ub                  upper_bound
#define mp                  make_pair
#define mt                  make_tuple
#define pll                 pair<ll , ll>
#define vll                 vector<ll>
#define vvll                vector<vll>
#define vpll                vector<pll>
#define all(c)              (c).begin(),(c).end()
#define sz(c)               (int)(c.size())
#define get(x,c)            get<x>(c)
#define trav(a,x)           for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i, n)           for(int i = 0; i < (n) ; i++)
#define FOR(i, a, b)        for(int i = (a); i <= (b); i++)
#define FORR(i, b, a)       for(int i = (b); i >= (a); i--)

inline ll gcd(ll a,ll b) {if(b == 0) return a; a %= b; return gcd(b , a);}
inline ll max(ll a,ll b) {return((a > b) ? a : b);}
inline ll min(ll a,ll b) {return((a > b) ? b : a);}
ll power(ll x,ll ex);
ll powermod(ll x,ll ex,ll md);

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e5+11;

void solve(){
    ll n;
    cin >> n;

    vll a(n) , b(n) , c(n);
    rep(i , n) cin >> a[i];
    rep(i , n) cin >> b[i];

    rep(i , n) cin >> c[i];

    vll d(n);
    rep(i , n) d[i] = b[c[i] - 1];

    map<ll , ll> m1 , m2;

    rep(i , n){
        m1[a[i]]++;
        m2[d[i]]++;
    }

    ll ans = 0;
    trav(it , m1){
        ll x = it->f;

        auto it2 = m2.find(x);
        if(it2 != m2.end()){
            ans += (it->s)*(it2->s);
        }
    }
    cout << ans << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);

    ll NTC=1;
    // cin>>NTC;

    #ifdef SIEVE
        sieve();
    #endif
    #ifdef NCR
        factorial();
    #endif
    #ifdef PREPROCESS
        preprocess();
    #endif

    ll PTC=0;
    while((PTC++)<NTC){
        // cout << "Case #" << PTC << ":" << ' ';
        solve();
        //cout<<"\n";
    }
    //cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
}

ll power(ll x,ll y){if(y==0) return 1;ll a=power(x,y/2);if(y%2==0) return a*a;else return x*a*a;}
ll powermod(ll x,ll ex,ll md){ll ans=1ll;while(ex>0){if(ex&1ll) ans=(ans*x)%md; ex>>=1ll;x=(x*x)%md;}return ans;}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef std::vector<bool> vb;
typedef std::vector<std::vector<bool>> vvb;
#define INF 1999999999
#define MODA 1000000007
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define rep1(i,n) for (long long i = 1; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define errvn1(x) cerr << #x <<" "<< x << endl;
#define errvn2(x, y) cerr << #x <<" "<< x <<" "<< #y <<" "<< y << endl;
#define errvn3(x, y, z) cerr << #x <<":"<< x <<" "<< #y <<":"<< y <<" "<< #z <<":"<< z << endl;
#define errvn4(x, y, z, a) cerr << #x <<":"<< x <<" "<< #y <<":"<< y <<" "<< #z <<":"<< z <<" "<< #a <<":"<< a << endl;
#define errop2(x, y) cerr << x <<" "<< y << endl;
#define errop3(x, y, z) cerr << x <<" "<< y <<" "<< z << endl;
#define errop4(x, y, z, a) cerr << x <<" "<< y <<" "<< z <<" "<< a << endl;

int main() {
  char S, T;
  cin >> S;
  cin >> T;

  if (S == 'Y') T -= 32;

  cout << T << endl;
  return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define inrange(a, x, b) (a <= x && x <= b)
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using vcvc = vector<vc>;
using pll = pair<ll, ll>;
// using mint = atcoder::static_modint<1'000'000'007>; // atcoder::static_modint<998'244'353>;
template<class T> void print(T x,bool cl=1){cout<<(cl?"\x1b[36m":"")<<x<<(cl?"\x1b[39m":"")<<'\n';}
template<class T> void print1d(T x,ll n=-1,bool cl=true){if(n==-1)n=x.size();rep(i,0,n){cout<<(cl?"\x1b[36m":"")<<x[i]<<(i==n-1?'\n':' ');}cout<<(cl?"\x1b[39m":"");}
template<class T> void print2d(T x,ll r=-1,ll c=-1,bool cl=1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c,cl);}
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> T rup(T a, T b) { return a / b + !!(a % b); }
template<class Arr, class T, size_t Sz> void myfill(Arr (&a)[Sz], const T &x) { fill((T*)a, (T*)(a + Sz), x); }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; }
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        }
        if (res < 0) { res += _mod; } return res;
}

int main()
{
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        ll ans = a*d - b*c;
        cout << ans << endl;
}


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

template<typename T>class Graph{
    public:
    struct edge{int to;T cost;};
    int Vertex_num,Edge_num;
    vector<edge>*g;

    const T INF=1000000000;

    Graph(int V){//0～V-1
        Vertex_num=V;
        g=new vector<edge>[V];
    }

    Graph(int V,int E){//0～V-1
        Vertex_num=V;
        Edge_num=E;
        g=new vector<edge>[V];
    }

    void emplace_back(int from,int to,T cost){
        edge e={to,cost};
        g[from].push_back(e);
        //edges->push_back(e);//for Bellman-Ford
    }

    void input(bool direct,bool weight){
        int from,to;
        T cost;
        for(int i=0;i<Edge_num;i++){
            cin>>from>>to;
            from--,to--;
            if(weight)cin>>cost;
            else cost=1;
            this->emplace_back(from,to,cost);
            if(!direct)this->emplace_back(to,from,cost);
        }
    }

    void check(){
        for(int i=0;i<Vertex_num;i++){
            cout<<"Vertex "<<i<<endl;
            for(auto x:g[i])cout<<x.to<<" "<<x.cost<<endl;
        }
    }
};

template<typename T>vector<T>bfs(Graph<T>graph,int start){
    vector<T>dist(graph.Vertex_num,-1);//訪問:startからの距離 未訪問:-1
    deque<int>q;
    q.push_front(start);
    dist[start]=0;
    while(!q.empty()){
        int p=q.front();q.pop_front();
        for(auto x:graph.g[p])if(dist[x.to]==-1){
            dist[x.to]=dist[p]+x.cost;
            if(x.cost)q.push_back(x.to);
            else q.push_front(x.to);
        }
        //visited[]の更新はpushするときにやらないとqueueがあふれる↑
    }
    return dist;
}

int H,W,S,G;
int main(){
    cin>>H>>W;
    char a[H][W];
    for(int i=0;i<H*W;i++)cin>>a[i/W][i%W];

    int d4[5]={1,0,-1,0,1};
    Graph<int>g(H*W+26);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(a[i][j]=='#')continue;
            if(a[i][j]=='S')S=i*W+j;
            if(a[i][j]=='G')G=i*W+j;
            if('a'<=a[i][j]&&a[i][j]<='z'){
                g.emplace_back(i*W+j,H*W+a[i][j]-'a',1);
                g.emplace_back(H*W+a[i][j]-'a',i*W+j,0);
                g.Edge_num+=2;
            }
            for(int k=0;k<4;k++){
                int x=i+d4[k],y=j+d4[k+1];
                if (x<0||x>=H||y<0||y>=W||a[x][y]=='#')continue;
                g.emplace_back(i*W+j,x*W+y,1);
                g.Edge_num++;
            }
        }
    }
    auto d=bfs(g,S);
    cout<<d[G]<<endl;
    return 0;
}

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int,int> pii;
int h,w,dis[4000500],sx,sy,tx,ty,vis[4000500];
char sp[2005][2005];
priority_queue<pii > q;
vector<int> gg[30];

int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};

int dp(int i,int j){return i*w+j;}

int main()
{
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++)
		scanf("%s",sp[i]);
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
		{
			if(sp[i][j]=='S') sx=i,sy=j;
			if(sp[i][j]=='G') tx=i,ty=j;
			if(sp[i][j]>='a' && sp[i][j]<='z')
				gg[sp[i][j]-'a'].push_back(i*w+j);
		}
	memset(dis,-1,sizeof(dis));
	dis[sx*w+sy]=0;
	q.push(make_pair(0,sx*w+sy));
	while(!q.empty())
	{
		int now=q.top().second;q.pop();
		if(vis[now]) continue;vis[now]=1;
		if(now<h*w){
			int x=now/w,y=now%w;
			for(int a=0;a<4;a++)
			{
				int nx=x+dx[a],ny=y+dy[a];
				if(nx>=0 && nx<h && ny>=0 && ny<w && sp[nx][ny]!='#' && (dis[nx*w+ny]==-1 || dis[nx*w+ny]>dis[now]+1))
				{
					dis[nx*w+ny]=dis[now]+1;
					q.push(make_pair(-dis[nx*w+ny],nx*w+ny));
				}
			}
			if(sp[x][y]>='a' && sp[x][y]<='z')
			{
				int c=sp[x][y]-'a';
				if(dis[c+h*w]==-1 || dis[c+h*w]>dis[now])
				{
					dis[c+h*w]=dis[now];
					q.push(make_pair(-dis[c+h*w],c+h*w));
				}
			}
		} else {
			int c=now-h*w;
			for(int i=0;i<gg[c].size();i++)
			{
				if(dis[gg[c][i]]==-1 || dis[gg[c][i]]>dis[now]+1)
				{
					dis[gg[c][i]]=dis[now]+1;
					q.push(make_pair(-dis[gg[c][i]],gg[c][i]));
				}
			}
		}
	}
	// cout<<dis[dp(0,1)]<<" "<<dis[]
	printf("%d\n",dis[tx*w+ty]);
	return 0;
}


#include <bits/stdc++.h>
#include <cmath>

using namespace std;
using ll = long long;

int main () {
    ll n, a, p, x, min=1000000000;
    cin >> n;

    for (int i=0; i<n; i++){
        cin >> a >> p >> x;
        int zai =0;

        if (x-a>0){
            if(p<min){
                min = p;
            }
        }
    }
    if (min < 1000000000){
        cout << min <<endl;
    }
    else {
        cout << -1 << endl;
    }
}

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

int32_t main()
{  int i,j,n,a[10004],b,x;
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int  d=0;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
int min1,max1=0;
for(i=0;i<n;i++)
{ min1=a[i];
for(j=i;j<n;j++)
{ min1=min(a[j],min1);
  max1=max(max1 ,min1* (j-i+1));
}
}
cout<<max1;
return 0;

}


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

template<int MOD>
class ModInt {
 public:
  int v;

  ModInt() : v(0) {}
  ModInt(long long _v) {
    v = int((-MOD < _v && _v < MOD) ? (_v) : (_v % MOD));
    if (v < 0) v += MOD; }

  friend bool operator==(const ModInt &a, const ModInt &b) { return a.v == b.v; }
  friend bool operator!=(const ModInt &a, const ModInt &b) { return a.v != b.v; }
  friend bool operator<(const ModInt &a, const ModInt &b) { return a.v < b.v; }
  friend bool operator<=(const ModInt &a, const ModInt &b) { return a.v <= b.v; }
  friend bool operator>(const ModInt &a, const ModInt &b) { return a.v > b.v; }
  friend bool operator>=(const ModInt &a, const ModInt &b) { return a.v >= b.v; }

  ModInt& operator+=(const ModInt &a) {
    if ((v += a.v) >= MOD) v -= MOD;
    return *this; }
  ModInt& operator-=(const ModInt &a) {
    if ((v -= a.v) < 0) v += MOD;
    return *this; }
  ModInt& operator*=(const ModInt &a) {
    v = 1ll * v * a.v % MOD;
    return *this; }
  ModInt& operator/=(const ModInt &a) {
    return (*this) *= inverse(a); }

  friend ModInt pow(ModInt a, long long x) {
    ModInt res = 1; assert(x >= 0);
    for (; x; x /= 2, a *= a) if (x & 1) res *= a;
    return res; }
  friend ModInt inverse(ModInt a) {
    assert(a.v != 0);
    return pow(a, MOD - 2); }

  ModInt operator+() const { return ModInt(v); }
  ModInt operator-() const { return ModInt(-v); }
  ModInt operator++() const { return *this += 1; }
  ModInt operator--() const { return *this -= 1; }

  friend ModInt operator+(ModInt a, const ModInt &b) { return a += b; }
  friend ModInt operator-(ModInt a, const ModInt &b) { return a -= b; }
  friend ModInt operator*(ModInt a, const ModInt &b) { return a *= b; }
  friend ModInt operator/(ModInt a, const ModInt &b) { return a /= b; }

  friend istream& operator>>(istream &is, ModInt &v) { is >> v.v; return is; }
  friend ostream& operator<<(ostream &os, const ModInt &v) { os << v.v; return os; }
};

const int MOD = 998244353;
using Mint = ModInt<MOD>;

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

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

  const int MAX = 3e5;
  vector<Mint> fact(MAX);
  vector<Mint> inv(MAX);
  fact[0] = inv[0] = 1;
  for (int i = 1; i < MAX; i++) {
    fact[i] = i * fact[i - 1];
    inv[i] = Mint(1) / fact[i];
  }
  const auto C = [&](int n, int k) -> Mint {
    if (k < 0 || k > n) return 0;
    return fact[n] * inv[k] * inv[n - k];
  };

  vector<int> primes;
  vector<int> isprime(MAX, 1);
  isprime[0] = isprime[1] = 0;
  for (int i = 2; i < MAX; i++) if (isprime[i]) {
    primes.emplace_back(i);
    for (int j = i + i; j < MAX; j += i) {
      isprime[j] = 0;
    }
  }

  vector<vector<int>> pos;
  vector<int> cur;
  Mint ans = 0;

  const auto Solve = [&]() -> Mint {
    Mint res = 1;
    for (int i = 0; i < cur.size(); i++) {
      int j = i;
      while (j + 1 < cur.size() && cur[i] == cur[j + 1]) j++;
      res *= C(N + j - i, j - i + 1);
      i = j;
    }
    return res;
  };

  const auto Dfs = [&](const auto &self, lint mul, int ptr) -> void {
    if (mul <= M) ans += Solve();
    for (int i = ptr; i < primes.size() && 1ll * mul * primes[i] < MAX; i++) {
      cur.emplace_back(primes[i]);
      self(self, mul * primes[i], i);
      cur.pop_back();
    }
  };

  Dfs(Dfs, 1, 0);
  cout << ans << '\n';
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll,ll> P;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
#define IINF
ll solve(string s){
    vector<ll> c(10);
    //REP(i,10) cards[i] = i;
    iota(c.begin(), c.end(), 0);
    for(char it : s) c[it - '0'] *= 10;
    // ll ret = 0;
    // for(auto it : cards) ret += it;
    // return ret;
    return accumulate(c.begin(), c.end(), 0LL);
}

int main(void){
    ll k, all = 0, win = 0;
    string s,t;
    cin >> k >> s >> t;
    vector<ll> cards(10, k);

    REP(i,5){
        cards[s[i] - '0']--; cards[t[i]-'0']--;
    }
    FOR(i,1,10){
        FOR(j,1,10){
            //if(cards[i] == 0 || cards[j] == 0) continue;
            s.back() = '0' + i;
            t.back() = '0' + j;
            if(solve(s) <= solve(t)) continue;
            win += cards[i] * (cards[j] - (i == j));
        }
    }

    all = 9 * k - 8;
    cout << setprecision(15) << double(win) / all / (all - 1) << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int T;
long long int X, Y, P, Q;

long long int INF = 8300000000000000008;

long long int gcdExt(long long int a, long long int b, long long int &x, long long int &y) {

	if (b == 0) {
		x = 1; y = 0;
		return a;
	}
	long long int X, Y;
	long long int d=gcdExt(b, a%b, X, Y);
	x = Y;
	y = X - a / b*Y;

	return d;
}
/*
pair<long long int, long long int> ChineseRem(long long int y1, long long int m1, long long int y2, long long int m2) {

	long long int p, q;
	long long int d = gcdExt(m1, m2, p, q);

	if (abs(y2 - y1) % d != 0) { return make_pair(0, -1); }

	long long int m = (m1 / d)*m2;

	long long int tmp = ((y2 - y1) / d)*m1;

	tmp %= m;  tmp = (tmp + m) % m;

	tmp *= (p%m); tmp %= m; tmp = (tmp + m) % m;

	return make_pair((y1 + tmp) % m, m);

}
*/

// 負の数にも対応した mod
// 例えば -17 を 5 で割った余りは本当は 3 (-17 ≡ 3 (mod. 5))
// しかし単に -17 % 5 では -2 になってしまう
inline long long mod(long long a, long long m) {
	return (a % m + m) % m;
}

// 拡張 Euclid の互除法
// ap + bq = gcd(a, b) となる (p, q) を求め、d = gcd(a, b) をリターンします
long long extGcd(long long a, long long b, long long &p, long long &q) {
	if (b == 0) { p = 1; q = 0; return a; }
	long long d = extGcd(b, a%b, q, p);
	q -= a / b * p;
	return d;
}

// 中国剰余定理
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
	long long p, q;
	long long d = extGcd(m1, m2, p, q); // p is inv of m1/d (mod. m2/d)
	if ((b2 - b1) % d != 0) return make_pair(0, -1);
	long long m = m1 * (m2 / d); // lcm of (m1, m2)
	long long tmp = (b2 - b1) / d * p % (m2 / d);
	long long r = mod(b1 + m1 * tmp, m);
	return make_pair(r, m);
}

int main(void) {

	long long int y1, m1, y2, m2;

	/*cin >> y1 >> m1 >> y2 >> m2;
	auto ret = ChineseRem(y1, m1, y2, m2);
	cout << ret.first<<" "<<ret.second << endl;

		 return 0;*/
	cin >> T;
	for (int t = 1; t <= T; t++) {
		cin >> X >> Y >> P >> Q;

		long long int Ts = X * 2 + Y * 2;
		long long int Ss = P + Q;

		long long int ans = INF;
		for (long long int y = X; y <= X + Y - 1; y++) {
			for (long long int q = P; q <= P + Q - 1; q++) {

				auto ret = ChineseRem(y, Ts, q, Ss);

				if (ret.second == -1) { continue; }
				else {
					ans = min(ans, ret.first);
				}

			}// q-loop

		}//y-loop

		if (ans >= INF) { cout << "infinity" << endl; }
		else { cout << ans << endl; }
	}

	return 0;
}

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

#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;

// Euclides Estendido
ll gcd(ll A, ll B, ll &X, ll &Y) {
	if(B == 0) {
		X = 1; Y = 0;
		return A;
	}
	ll x1, y1;
	ll G = gcd(B, A % B, x1, y1);
	X = y1; Y = x1 - (A / B) * y1;
	return G;
}

// Acha a primeira vez que dois eventos ocorrem ao mesmo tempo
// Os eventos acontecem a cada:
// A * T1 + Z1 e B * T2 + Z2
ll solve(ll A, ll B, ll Z1, ll Z2) {
	if(Z2 > Z1) swap(A, B), swap(Z1, Z2);
	ll X, Y, ans = 0;
	ll G = gcd(A, B, X, Y), C = Z2-Z1;
	if(C%G) return 1LL << 62;	// impossivel
	C /= G; X *= C; Y *= C;
	// Acho o primeiro X positivo
	if(X >= 0) {
		ll K = (X * G) / B;
		ans = A * (X - K * (B / G)) + Z1;
	} else {
		ll K = (-X * G + B - 1) / B;
		ans = A * (X + K * (B / G)) + Z1;
	}
	// retorna um par na forma (A, Z)
	// A -> novo tamanho do ciclo
	// Z -> primeira vez que acontece
	// return mk(A * (B / G), ans);
	return ans;
}

// Anotação importante, Há duas formas de alterar as soluções:
// (1) -> X = X + K * (B / G) e Y = Y - K * (A / G)
// (2) -> X = X - K * (B / G) e Y = Y + K * (A / G)

int main(int argc, char** argv) {
	int T, X, Y, P, Q;
	scanf("%d", &T);
	rep(t, 0, T) {
		ll ans = (1LL <<62);
		scanf("%d%d", &X, &Y);
		scanf("%d%d", &P, &Q);
		rep(y, 0, Y) rep(q, 0, Q)
			ans = min(ans, solve(2*X+2*Y, P+Q, X + y, P + q));
		if(ans != (1LL << 62))
			printf("%lld\n", ans);
		else puts("infinity");
	}
	return 0;
}


/*
BY: shalekberli (Shahin Alekberli)
LANG: C++
*/
#include <bits/stdc++.h>
//MACROS//
#define PVP ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define _crt_secure_no_warnings
#define endl '\n'
#define pb push_back
#define mp make_pair
#define gf greater<int>()
#define INF 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define UB upper_bound
#define LB lower_bound
#define F first
#define S second
#define MAX 100000000
#define mod 1000000007LL
#define MOD 998244353LL
#define MoD 16714589LL
#define Max 1e18
#define ll long long
#define lld long double
#define usi unsigned int
#define pll pair<ll, ll>
#define pii pair<int, int>
#define loop1(i, n) for (ll i = 1; i <= (n); i++)
#define loop0(i, n) for (ll i = 0; i < (n); i++)
#define loop(i, k, n) for(ll i = (k);i <= (n);i++)
#define loopr(i, k, n) for (ll i = (k); i >= (n); i--)
using namespace std;

int main(){
	PVP
	double a, b; cin >> a >> b;
	cout << a * (b / 100);
	return 0;
}

#include <iostream>
using namespace std;
int main(){
  int a,b;float x=0;
  cin>>a>>b;
  x=float(a*b)/100.0;
  cout<<x;
  return 0;
}


//~ author      : Sumit Prajapati
#include <bits/stdc++.h>
using namespace std;

#define ull                 unsigned long long
#define ll                  long long
#define int                 long long
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pb                  push_back
#define mk                  make_pair
#define ff                  first
#define ss                  second
#define all(a)              a.begin(),a.end()
#define trav(x,v)           for(auto &x:v)
#define rep(i,n)            for(int i=0;i<n;i++)
#define repe(i,n)           for(int i=1;i<=n;i++)
#define read(a,n)           rep(i,n)cin>>a[i]
#define reade(a,n)          repe(i,n)cin>>a[i]
#define FOR(i,a,b)          for(int i=a;i<=b;i++)
#define printar(a,s,e)      FOR(i,s,e)cout<<a[i]<<" ";cout<<'\n'
#define curtime             chrono::high_resolution_clock::now()
#define timedif(start,end)  chrono::duration_cast<chrono::nanoseconds>(end - start).count()

auto time0 = curtime;
const int MD=1e9+7;
const int MDL=998244353;
const int INF=1e9;
const int MX=1e6+2;

int LPF[MX];
int mobius[MX];
int ffR[MX];
int ffL[MX];
int l,r;

void init(){
   for (int i = 2; i < MX; i++)

        // If it is a prime number
        if (!LPF[i])

            for (int j = i; j < MX; j += i)

                // For all multiples which are not
                // visited yet.
                if (!LPF[j])
                    LPF[j] = i;

    mobius[1]=1LL;
    for (int i = 2LL; i < MX; i++) {
        if (LPF[i / LPF[i]] == LPF[i])
            mobius[i] = 0;
        else
            mobius[i] = -1LL * mobius[i / LPF[i]];

    }
    for(int i=1LL;i<MX;i++)
        for(int j=i;j<MX;j+=i){
            ffR[j]+=(mobius[i]*(r/i));
            ffL[j]+=(mobius[i]*((j-1)/i));
        }

}

int count(int x){
    int divis=r/x;
    // cout<<divis<<" "
    // 7-(1+1)
    // 7 8 9 10 5-(5+())
    return (r-x+1LL)-(divis+ffR[x]-ffL[x]);
}

void solve(){

    int ans=0;
    cin>>l>>r;
    init();
    for(int x=max(2LL,l);x<=r;x++){
        // cout<<x<<" -> "<<ffL[x]<<" "<<ffR[x]<<" "<<count(x)<<'\n';
        ans+=count(x);
    }
    ans<<=1LL;
    cout<<ans<<'\n';

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    time0 = curtime;
    srand(time(NULL));
    int t=1;
    // cin>>t;
    repe(tt,t){
        // cout<<"Case #"<<tt<<": ";
        solve();
    }

    cerr<<"Execution Time: "<<timedif(time0,curtime)*1e-9<<" sec\n";
    return 0;

}

#include <bits/stdc++.h>
using namespace std;
const int maxn=1e6+13;
typedef long long ll;
int p[maxn+13];
ll mu[maxn+13];
int tag[maxn+13];
void pre_mu(){
	mu[1]=1;
	int cnt=0;
	for(int i=2;i<=maxn;i++)
	{
		if(!tag[i]) mu[i]=-1,p[++cnt]=i;
		for(int j=1;j<=cnt&&i*p[j]<=maxn;j++)
		{
			tag[i*p[j]]=1;
			if(i%p[j]==0)
			{
				mu[i*p[j]]=0;
				break;
			}
			mu[i*p[j]]=-mu[i];
		}
	}
	for(int i=1;i<=maxn;i++) mu[i]+=mu[i-1];
}
ll cal(int l,int r){
	int j;
	ll sum=0;
	for(int i=1;i<=min(l,r);i=j+1){
		j=min(l/(l/i),r/(r/i));
		sum+=1ll*(mu[j]-mu[i-1])*(l/i)*(r/i);
	}
	return sum;
}
int main(){
	int l,r;
	scanf("%d%d",&l,&r);
	pre_mu();
	ll ans=1ll*(r-l+1)*(r-l+1);
	ans-=(cal(r,r)-2*cal(l-1,r)+cal(l-1,l-1));
	for(int i=l;i<=r;i++){
		if(i==1) continue;
		ans++;
		for(int j=i;j<=r;j+=i){
			ans-=2;
		}
	}
	printf("%lld",ans);
}


#include<bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> iipair;
typedef pair<unsigned,unsigned> uupair;
typedef vector<int> vec;
typedef vector<unsigned> uvec;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll sx,sy,gx,gy;
	cin>>sx>>sy>>gx>>gy;
	ld res = (static_cast<ld>(sx*gy + sy*gx))/(sy+gy);
	cout<<fixed<<setprecision(12)<<res;
}

#include <bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(int i=a; i<=b; i++)
using namespace std;
long double n, m;
long long k;
const int MaxN = 1e5 + 4;
long double a[MaxN];
long long b[MaxN];
pair<long double, int> c[MaxN];
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll t = 0, n, k, m;
	cin >> k >> n >> m;
	For(i, 1, k) cin >> a[i];
	For(i, 1, k) b[i] = (a[i] * m) / n, t += b[i];
	int cnt = m - t;
	For(i, 1, k) {
		long double s = a[i], s2 = b[i], s3 = b[i] + 1;
		s /= (n * 1.0);
		s2 /= (m * 1.0);
		s3 /= (m * 1.0);
		s = abs(s3 - s) - abs(s2 - s);
		c[i] = {s, i};
	}
	sort(c + 1, c + k + 1);
	For(i, 1, k) {
		if (cnt == 0) break;
		b[c[i].second]++;
		cnt--;
		if (cnt == 0) break;
	}
	For(i, 1, k) cout << b[i] << ' ';
}


#include <vector>
#include <iostream>

using namespace std;
#define debug puts("pigtoria bling bling ⚡⚡");

// https://atcoder.jp/contests/abc195/editorial/897
// tips: and | or , in reverse order.
int main() {
    int N;
    string S, X, T;
    cin >> N >> S >> X;
    bool win;
    vector <vector<bool>> dp(N + 1, vector<bool>(7, false));// t win
    dp[N][0] = true;// 无论之前是什么样子，只要最后是7的base，那么，肯定是T win
    for (int i = N - 1; i >= 0; i--) {
        for (int j = 0; j < 7; j++) {
            if (X[i] == 'A') {
                if (dp[i + 1][(j * 10) % 7] && dp[i + 1][((j * 10) + S[i] - '0') % 7]) {
                    dp[i][j] = true;
                }
            } else {
                if (dp[i + 1][(j * 10) % 7] || dp[i + 1][((j * 10) + S[i] - '0') % 7]) {
                    dp[i][j] = true;
                }
            }

        }
    }
    win = dp[0][0];
    if (win) cout << "Takahashi";
    else cout << "Aoki";
    return 0;
}

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fi first
#define se second
#define SZ(x) ((int)(x).size())

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

template<typename T> inline void ckmax(T& x, T y) { x = (y > x ? y : x); }
template<typename T> inline void ckmin(T& x, T y) { x = (y < x ? y : x); }

const int MOD = 998244353;

inline int mod1(int x) { return x < MOD ? x : x - MOD; }
inline int mod2(int x) { return x < 0 ? x + MOD : x; }
inline void add(int &x, int y) { x = mod1(x + y); }
inline void sub(int &x, int y) { x = mod2(x - y); }
inline int pow_mod(int x, int i) {
	int y = 1;
	while (i) {
		if (i & 1) y = (ll)y * x % MOD;
		x = (ll)x * x % MOD;
		i >>= 1;
	}
	return y;
}

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	if(n == 1) {
		cout << pow_mod(k, m) << '\n';
		return 0;
	}
	if(m == 1) {
		cout << pow_mod(k, n) << '\n';
		return 0;
	}
	int ans = 0;
	for(int x = 1; x <= k; ++x) {
		int a = pow_mod(x, n);
		sub(a, pow_mod(x - 1, n));
		int b = pow_mod(k - x + 1, m);
		int val = (1ll * a * b) % MOD;
		add(ans, val);
	}
	cout << ans << '\n';
}


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

int main() {
int n , w ,i;

cin>> n >> w ;
int coun=w;
for (  i =0 ; coun<=n ; i++)
{
  coun +=w;
}
cout <<i;

}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = (ll)(1e5)+10, mod = (ll)(1e9+7);
const ll INF=1e17;
ll dp[N];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int a,b; cin >> a >> b;
	if(a==b)cout << a;
	else{
        if(a==0 && b==1)cout << 2;
        else if(a==0 && b==2)cout << 1;
        else if(a==1 && b==0)cout << 2;
        else if(a==1 && b==2)cout << 0;
        else if(a==2 && b==0)cout << 1;
        else if(a==2 && b==1)cout << 0;
	}
}


#include "bits/stdc++.h"

#define int long long

using namespace std;
using i128 = __int128_t;

random_device rd;
mt19937 gen(rd());

#define random_shuffle(begin, end) shuffle(begin, end, gen)

template <typename T, typename U>
ostream& operator << (ostream& out, const pair <T, U> &p) {
    out << p.first << ": " << p.second;
    return out;
}

template <typename Container>
ostream& print_container(ostream& out, const Container &container, const string &open, const string &close, const string sep=", ") {
    out << open;
    for (const auto &elem : container)
        out << elem << sep;
    out << "\b\b" << close << endl;
    return out;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &v) {
    return print_container(out, v, "[", "]");
}

template <typename T>
ostream& operator << (ostream& out, const set<T> &s) {
    return print_container(out, s, "{", "}");
}

template <typename T>
ostream& operator << (ostream& out, const unordered_set<T> &s) {
    return print_container(out, s, "{", "}");
}

template <typename K, typename V>
ostream& operator << (ostream& out, const map<K, V> &s) {
    return print_container(out, s, "{", "}");
}

template <typename K, typename V>
ostream& operator << (ostream& out, const unordered_map<K, V> &s) {
    return print_container(out, s, "{", "}");
}

template<typename... Args>
void writeln(Args... args) {
    ((cout << args << " "), ...);
    cout << endl;
}

namespace std {
    template <typename T, typename U> struct hash<pair <T, U> > {
        size_t operator()(const pair <T, U> &p) const {
            hash<int> hasher;
            size_t seed = 0;
            seed ^= hasher(p.first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
            seed ^= hasher(p.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
            return seed;
        }
    };
}

// End of template

int32_t main() {
    ios_base::sync_with_stdio(false);

#ifdef LOCAL_JUDGE
    if (freopen("input.txt", "r", stdin) == NULL) {
        cerr << "Couldn't open file for reading" << endl;
        return 0;
    }
#endif
	string s;
    cin >> s;
    vector <string> q(2);
    int idx = 1;
    for (int i = s.length() - 1; i >= 0; --i) {
        if (s[i] == 'R')
            idx = 1 - idx;
        else
            q[idx].push_back(s[i]);
    }
    reverse(q[1].begin(), q[1].end());
    string t = q[0] + q[1];
    stack <char> st;
    for (char c : t)
        if (st.empty() || st.top() != c)
            st.push(c);
        else
            st.pop();
    string res;
    while (!st.empty()) {
        res.push_back(st.top());
        st.pop();
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}

#include <bits/stdc++.h>

const long long SZ = 1e5 + 7;
const long long inf = 1e18;
const long long MOD = 1e9 + 7;
const long long mod = 1e9 + 7;
long long opnmbr = 1;

#define ll                  long long
#define ld                  long double

#define pb                  push_back
#define mp                  make_pair
#define eb                  emplace_back

#define pll                 pair<ll, ll>
#define vi                  vector<ll>
#define vs                  vector<string>
#define vpl                 vector<pll>
#define qi                  queue<ll>
#define si                  set<ll>
#define mi                  map<ll, ll>
#define umi                 unordered_map<ll, ll>

#define fi                  first
#define se                  second

#define sz(x)               (ll)x.size()

#define all(c)              (c).begin(), (c).end()
#define allr(c)             (c).rbegin(), (c).rend()

#define Max(a,b)            ((a > b) ? a : b)
#define Min(a,b)            ((a < b) ? a : b)

#define ci(X)               ll X; cin>>X
#define cii(X, Y)           ll X, Y; cin>>X>>Y
#define ciii(X, Y, Z)       ll X, Y, Z; cin>>X>>Y>>Z
#define ciiii(W, X, Y, Z)   ll W, X, Y, Z; cin>>W>>X>>Y>>Z

#define dbg(x)              cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y)           cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl;
#define dbg3(x,y,z)         cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w)       cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<" "<<#w<<"="<<(w)<<endl;

#define ons()               cout<<"Case #"<<opnmbr++<<": ";
#define krosuru             ll ___T; cin>>___T; while (___T-- > 0)
#define yehbhitheekhai      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define inf                 1e18
#define Endl                endl

#define forn(i, n)          for(ll i = 0; i < (n); i++)
#define fore(i, n)          for(ll i = 1; i <= (n); i++)
#define forl(i, l, r)       for(ll i = l; i < (r); i++)
#define forr(i, l, r)       for(ll i = l; i >= (r); i--)

#define ms0(X)              memset((X), 0, sizeof((X)))
#define ms1(X, V)           memset((X), -1, sizeof((X)))
#define flv(X, V)           fill(all((X)), V)

using namespace std;

ll powermod(ll a, ll b)
{
    ll ans = 1;
    while (b)
    {
        if (b & 1) ans = (ans * a) % MOD;
        b = b / 2;
        a = (a * a) % MOD;
    }
    return ans;
}

ll gcd(ll a, ll b)
{
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}

void krdiyasuru()
{
    string s;
    cin >> s;
    ll n = sz(s);
    string ans = "";
    deque<char> str;
    ll f = 1;
    forn(i, n)
    {
        if(s[i] == 'R')
        {
            f ^= 1;
        }
        else
        {
            if(f == 1)
            {
                str.pb(s[i]);
            }
            else
            {
                str.push_front(s[i]);
            }
        }
    }
    for(auto x: str)
    {
        ans += x;
    }
    if(f == 0)
    {
        reverse(all(ans));
    }
    string a;
    for(auto& c : ans)
    {
        if(sz(a) && a.back() == c)
        {
            a.pop_back();
        }
        else
        {
            a.pb(c);
        }
    }
    cout<<a<<endl;
    return;
}

int main()
{
    yehbhitheekhai;
    //    solve();
    //    krosuru
    {
        krdiyasuru();
    }
}


#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;

signed main(){

    int N, K; cin >> N >> K;
    vec a(N); cin >> a;
    vec cnt(N, 0);
    REP(i, N) cnt[a[i]]++;

    int k = K;
    int ans = 0;
    REP(i, N){
        chmin(k, cnt[i]);
        ans += k;
    }
    Out(ans);

    return 0;
}

#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=200010;

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

    ll n,k;
    cin>>n>>k;
    vector<ll> ar(n+1,0);
    for(ll i=0;i<n;++i){
        ll x;
        cin>>x;
        ar[x]+=1;
    }
    ll ans=0;
    vector<ll> v(k,0);
    ll idx=k;
    for(ll i=0;i<=n;++i){
        if(ar[i]<idx){
            ans+=i*(idx-ar[i]);
            idx=ar[i];
        }
    }
    cout<<ans;

    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
#include <climits>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main() {
    fast_cin();
    ll n, x;

    cin>>n>>x;

    ll a;

    for(ll i = 0; i < n; ++i){

        cin>>a;
        if(a != x){
            cout<<a<<" ";
        }
    }

    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int x,y,z;
    cin>>x>>z;
    for(int i=0;i<x;i++)
    {
        cin>>y;
        if(y==z)
            continue;
        else
            cout<<y<<" ";
    }
    return 0;
}


#define DEB
#include <map>
#include <set>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>

#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;

#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> bool chmin(T& a,const T& b) {
    if(a>b) {
        a=b;
        return true;
    }
    return false;
}
template<class T> bool chmax(T& a,const T& b) {
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
    template<class S,class T>
    ostream &operator <<(ostream& out,const pair<S,T>& a){
        out<<'('<<a.fr<<','<<a.sc<<')';
        return out;
    }
}

//const int INF=5e8;

char buf[105][105];
int h, w;
int main(){
    cin>>h>>w;
    REP(i,h) scanf("%s",buf[i]);
    int res=0;
    REP(i,h) REP(j,w-1) if(buf[i][j]=='.' && buf[i][j+1]=='.'){
        ++res;
    }
    REP(i,h-1) REP(j,w) if(buf[i][j]=='.' && buf[i+1][j]=='.'){
        ++res;
    }
    cout<<res<<endl;

}

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int H,W,ans=0;
	string S[102];
	bool a[102][102]={0};
	cin>>H>>W;
	for(int i=0;i<H;i++){
		cin>>S[i];
		for(int j=0;j<W;j++){
			if(S[i][j]=='.')a[i+1][j+1]=true;
		}
	}
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			ans+=a[i][j]&&a[i][j+1];
			ans+=a[i][j]&&a[i+1][j];
		}
	}
	cout<<ans;
	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

#define N 10100
#define MOD 998244353
#define ll long long
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define rep3(i, a, b) for(int i = a; i >= b; --i)
#define eb emplace_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
struct Setup_io {
	Setup_io() {
		ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
		cout << fixed << setprecision(15);
	}
} setup_io;

int main() {
	int n;
	int x, s;
	int a[100];
	ll dp[101][N];
	ll k[110];
	ll y, z;
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n + 1) {
		rep(j, N)dp[i][j] = 0;
	}
	s = 0;
	dp[0][0] = 1;
	rep(i, n) {
		s += a[i];
		rep3(ii, i, 0) {
			rep3(j, 100*(i+1), a[i])dp[ii + 1][j] = (dp[ii + 1][j] + dp[ii][j - a[i]]) % MOD;
		}
	}
	if (s % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	s /= 2;
	k[0] = 1;
	rep2(i, 1, 100) {
		y = (ll)i;
		k[i] = (k[i - 1] * y) % MOD;
	}
	ll ans = 0;
	rep(i, n + 1) {
		y = dp[i][s];
		y = (y*k[i]) % MOD;
		y = (y*k[n - i]) % MOD;
		ans = (ans + y) % MOD;
	}
	cout << ans << endl;
	return 0;
}

#include <cstdio>
#include <cstring>
const int maxn=100+10;
const int Mod=998244353;
int w[maxn];
int dp[2][maxn][maxn*maxn*2];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&w[i]);
	int ze=100*100+100;
	int now=0;
	dp[now^1][0][ze]=1;
	for(int i=1;i<=n;i++,now^=1){
		memset(dp[now],0,sizeof(dp[now]));
		for(int k=0;k<=i;k++)
			for(int j=ze-100*100;j<=ze+100*100;j++)
				dp[now][k][j]=((k?1ll*dp[now^1][k-1][j-w[i]]*k:0)+1ll*dp[now^1][k][j+w[i]]*(i-k))%Mod;
	}
	int ans=0;
	for(int i=0;i<=n;i++)
		ans=(ans+dp[now^1][i][ze])%Mod;
	printf("%d",ans);
	return 0;
}


/*
start of cp 3.0BETA
NEW-BETA-LADDER
https://codeforces.com/problemset/page/1?tags=1800-1800
DEAD PERSON CODING
*/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define graph vector<vector<int>>
#define print(s) for(auto it:s) cout<<it<<" "
#define print2(s) for(auto it:s) cout<<it.fi<<" : "<<it.se
#define uset unordered_set
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vi,greater<int>>
#define ln cout<<'\n'
#define space cout<<" "
#define len(x) x.size()
#define bits(x) __builtin_popcount(x)
void fileio()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
graph g;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    fileio();
    int n,m;
    cin>>n>>m;
    int o=0,e=0;
    for(int i=0;i<n;i++){
        string x;
        cin>>x;
        int ct=0;
        for(int j=0;j<m;j++){
            ct+=(x[j]=='1');
        }
        if(ct&1)o++;
        else e++;
    }
    cout<<o*e;
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<(n);i++)
#define rep2(i,n,m) for(ll i=n;i<(m);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
void YES(int a){
  if(a) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
void Yes(int a){
  if(a) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

//#include <atcoder/all>

//using namespace atcoder;
//typedef modint998244353 mint;

int main(){
  ll N,M;
  cin>>N>>M;
  VS S(N);
  rep(i,N) cin>>S[i];
  VL V(N);
  rep(i,N){
    rep(j,M) if(S[i][j]=='1') V[i]++;
  }
  rep(i,N) V[i]%=2;
  map<ll,ll> Z;
  rep(i,N) Z[V[i]]++;
  ll ans=0;
  for(auto e:Z){
    ans+=(e.se)*(e.se-1)/2;
  }
  cout<<N*(N-1)/2-ans<<endl;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (auto &it: a) cin >> it;
    vector<ll> pre(n+1);
    ll pre_mx = 0, an = 0, pos = 0;
    for (int i = 0; i < n; ++i) {
        pre[i+1] = pre[i] + a[i];
        pre_mx = max(pre_mx, pre[i+1]);
        an = max(an, pos+pre_mx);
        pos += pre[i+1];
    }
    cout << an << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S,class T>auto&operator<<(ostream&os,map<S,T>mp){bool a=1;for(auto p:mp){os<<(a?"":", ")<<p;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vl a(n),b(n);
    cin>>a>>b;
    ll mval=0,ans=0;
    rep(i,n){
        chmax(mval, a[i]);
        chmax(ans, mval*b[i]);
        puta(ans);

    }
    return 0;
}


// --------------------------------------------------<C++ TEMPLATE>------------------------------------------------
/**
    *  Nitin Gangwar
    *  @wargang (codechef,codeforces,spoj,gfg)
    *  MNNIT allahabad
    *  CSE'23
    *  iamnitingangwar2000@gmail.com
**/

#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// MACROS
#define int                     long long
#define mp                      make_pair
#define pb                      push_back
#define MAX                     1e17
#define MIN                     -1e17
#define PI                      3.1415926535897932384626433832795
#define mod                     1000000007
#define set(x)                  memset(x, 0, sizeof(x))
#define clr(x)                  memset(x, -1, sizeof(x))
#define ff                      first
#define ss                      second
#define rep(i,n)                for(int i=0;i<(n);i++)
#define FOR(i,a,b)              for(int i=(a);i<=(b);i++)
#define FORD(i,a,b)             for(int i=(a);i>=(b);i--)
#define sz(x)                   x.size()
#define endl                    "\n"
#define deb(x)                  cout << #x << "=" << x << endl
#define deb2(x, y)              cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x)                  x.begin(), x.end()
#define lb(a,x)                 lower_bound(all(a),x)
#define ub(a,x)                 upper_bound(all(a),x)

typedef priority_queue<int>     maxHeap;
typedef priority_queue<int,     vector<int>, greater<int>> minHeap;
typedef pair<int, int>          pii;
typedef vector<int>             vi;
typedef vector<string>          vs;
typedef vector<pii>             vpii;
typedef vector<vi>              vvi;
typedef map<int, int>            mpii;
typedef set<int>                seti;
typedef multiset<int>           mseti;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// typedef long int                ld;
// typedef unsigned long int       lu;
// typedef long long int           ll;
// typedef unsigned long long int  llu;

// cout << fixed << setprecision(9) <<
int mpow(int base, int exp);

const int T2 = 105; const int T3 = 1005; const int T4 = 10005; const int T5 = 100005;
const int N = 20;
int n, m;
bool edge[N][N];
int dp[(1 << N)];

void solve() {
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a][b] = 1;
        edge[b][a] = 1;
    }
    for (int i = 0; i < (1 << n); i++) {
        dp[i] = 1;
        for (int j = 0; j < n; j++) {
            if (i & (1 << j))
                for (int k = j + 1; k < n; k++) {
                    if (i & (1 << k))
                        if (!edge[j][k])
                            dp[i] = MAX;
                }
        }
        for (int j = (i - 1) & i; j; j = (j - 1) & i)
            dp[i] = min(dp[i], dp[j] + dp[i ^ j]);
    }
    cout << dp[(1 << n) - 1] << endl;

}

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {

        // cout<<"Case #"<<i<<": ";

        solve();

    }
    return 0;
}

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(a) int(a.size())
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) { out << "(" << a.first << "," << a.second << ")"; return out; }
template <typename T, size_t N> ostream& operator <<(ostream& out, const array<T, N>& a) { out << "["; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]"; return out; }
template <typename T> ostream& operator <<(ostream& out, const vector<T>& a) { out << "["; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]"; return out; }
template <typename T, class Cmp> ostream& operator <<(ostream& out, const set<T, Cmp>& a) { out << "{"; bool first = true; for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}"; return out; }
template <typename U, typename T, class Cmp> ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) { out << "{"; bool first = true; for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}"; return out; }
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << ": " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << ": " << arg1 << " |"; __f(comma + 1, args...); }

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif

void solve() {
	int n, m; cin >> n >> m;
	vector<int> sub(1<<n);
	for(int i=0; i<m; i++) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		for(int k=1; k<(1<<n); k++) {
			if((k&(1<<a)) and (k&(1<<b))) {
				++sub[k];
			}
		}
	}
	vector<bool> valid(1<<n);
	for(int i=1; i<(1<<n); i++) {
		int cnt = bitset<32>(i).count();
		if((cnt*(cnt-1))/2 == sub[i]) {
			valid[i] = true;
		}
	}
	vector<int> dp(1<<n, 1e9);
	dp[0] = 0;
	for(int i=1; i<(1<<n); i++) {
		if(valid[i]) {
			dp[i] = 1;
		} else {
			for(int j=i; j; j=(j-1)&i) {
				dp[i] = min(dp[i], dp[j] + dp[i^j]);
			}
		}
	}
	cout << dp[(1<<n)-1] << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	solve();
	return 0;
}


#include <cstdlib>
#include<iostream>
#include<unordered_set>
#include<vector>
#include<cstring>
#include<string>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll = int64_t;
int main(){
    int n;
    cin >> n;
    vector<int> A(n+2);
    ll ans = 1;
    ll min_prime = 0; // 最小因数
    ll max_prime = 0;
    // A1 には1 A2には2を代入する
    A[0] = 1;
    for(ll i=2;i<=n;i++){
        min_prime = 0;
        for(ll j=1;j*j<=i;j++){
            if(i % j == 0 && j!=1) {
                min_prime = j;
                break;
            }
        }
        if(min_prime == 0)A[i-1] = 2;
        else{
            max_prime = i / min_prime;
            A[i-1] = A[max_prime-1] + 1;
        }
    }
    for(int i=0;i<n;i++){
        cout << A[i] << " ";
    }
    cout << endl;
    return 0;
}

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

int main(void)
{
    ll N;
    cin >> N;
    ll num = 1;
    ll count = 1;
    ll precount = 1;
    for (ll i = 1; i <= N; i++)
    {
        if (precount > num)
        {
            precount = 1;
            count ++;
            num = num * 2;
        }
        if (i != N)
        {
            cout << count << " ";
        }
        else
        {
            cout << count << endl;
        }
        precount++;
    }
}


#define wiwihorz
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1000000000000000000
#define eps (1e-9)
#define MAXN 1000005
#define MOD 1000000007

using namespace std;
using namespace __gnu_pbds;

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt199374 rnd(chrono::steady_clock::now().time_since_epoch().count())
#define treap tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); }
#else
#define print(...) 0
#define vprint(...) 0
#endif
struct mat {
	int n;
	vector<vector<int>> v;
	void init_(int _n) {
		n = _n;
		v.assign(n + 1, vector<int>(n + 1, 0));
	}
	void id() {
		rep(i, 1, n) v[i][i] = 1;
	}
	mat operator*(mat b) {
		mat ans; ans.init_(b.n);
		rep(i, 1, n) rep(j, 1, n) {
			rep(k, 1, n) {
				ans.v[i][j] = (ans.v[i][j] +
					v[i][k] * b.v[k][j] % MOD) % MOD;
			}
		}
		return ans;
	}
};
namespace solver {
	int n, m, k;
	vector<vector<int>> mp;
	vector<int> a;
	void init_(int _n, int _m, int _k) {
		n = _n, m = _m, k = _k;
		mp.assign(n + 1, vector<int>());
		a.assign(n + 1, 0);
	}
	int pow_(int a, int times) {
		int ans = 1;
		for(; times > 0; times >>= 1, a = a * a % MOD) {
			if(times & 1) ans = ans * a % MOD;
		}
		return ans;
	}
	void solve() {
		mat s, ans;
		s.init_(n), ans.init_(n), ans.id();
		int invM = pow_(m, MOD - 2), inv2 = pow_(2, MOD - 2);
		rep(i, 1, n) {
			s.v[i][i] = 1 - invM * mp[i].size() % MOD * inv2 % MOD;
			for(auto j : mp[i]) {
				s.v[i][j] = invM * inv2 % MOD;
			}
		}
		for(; k > 0; k >>= 1, s = s * s) {
			if(k & 1) ans = ans * s;
		}
		rep(i, 1, n) {
			int cur = 0;
			rep(j, 1, n) {
				cur += a[j] * ans.v[i][j];
				cur %= MOD;
			}
			cout << (cur % MOD + MOD) % MOD << "\n";
		}

	}

};
using namespace solver;
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int n, m, k; cin >> n >> m >> k;
	init_(n, m, k);
	rep(i, 1, n) cin >> a[i];
	rep(i, 1, m) {
		int x, y; cin >> x >> y;
		mp[x].push_back(y);
		mp[y].push_back(x);
	}
	solve();
	return 0;
}

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

using ll = long long;

// 組合せを素数で割った値
const int MAX = 510000;
const ll MOD = 1e9 + 7;
ll fac[MAX], finv[MAX], inv[MAX];

// 前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
ll COM(int n, int r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

// 繰り返し自乗法(x^nをmで割った余り) O(logn)
ll power(ll x, ll n, ll m) {
  ll res = 1;
  if (n > 0) {
    res = power(x, n / 2, m);
    if (n % 2 == 0) res = (res * res) % m;
    else res = ((res * res % m) * x) % m;
  }
  return res;
}

// A*B(行列の掛け算, 各項はmで割った余り)
vector<vector<ll>> mul(const vector<vector<ll>> &A, const vector<vector<ll>> &B, ll m) {
  vector<vector<ll>> C(A.size(), vector<ll>(B[0].size(), 0));
  for (int i = 0; i < A.size(); i++) {
    for (int k = 0; k < B.size(); k++) {
      for (int j = 0; j < B[0].size(); j++) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % m;
      }
    }
  }
  return C;
}

// A^n(行列累乗, 各項はmで割った余り)
vector<vector<ll>> power_M(vector<vector<ll>> A, ll n, ll m) {
  vector<vector<ll>> B(A.size(), vector<ll>(A.size(), 0));
  for (int i = 0; i < A.size(); i++) B[i][i] = 1;

  while (n > 0) {
    if (n & 1) B = mul(B, A, m);
    A = mul(A, A, m);
    n >>= 1;
  }
  return B;
}

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

  COMinit();

  ll n, m, kk;
  cin >> n >> m >> kk;

  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);

  vector<ll> x(m), y(m);
  for (int i = 0; i < m; i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
  }

  ll inv_2 = power(2, MOD - 2, MOD);

  vector<vector<ll>> M(n, vector<ll>(n, 0));
  for (int k = 0; k < m; k++) {
    M[x[k]][y[k]] += inv_2;
    M[x[k]][y[k]] %= MOD;
    M[x[k]][x[k]] += inv_2;
    M[x[k]][x[k]] %= MOD;
    M[y[k]][x[k]] += inv_2;
    M[y[k]][x[k]] %= MOD;
    M[y[k]][y[k]] += inv_2;
    M[y[k]][y[k]] %= MOD;
    for (int i = 0; i < n; i++) {
      if (i == x[k] || i == y[k]) continue;
      M[i][i] += 1;
      M[i][i] %= MOD;
    }
  }

  vector<vector<ll>> M2 = power_M(M, kk, MOD);

  ll keep = power(power(m, kk, MOD), MOD - 2, MOD);

  vector<ll> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
//      cout << M2[i][j] << " ";
      ans[i] += M2[i][j] * a[j] % MOD;
      ans[i] %= MOD;
    }
//    cout << endl;
    cout << (ans[i] * keep) % MOD << '\n';
  }
}