結果

問題 No.2983 Christmas Color Grid (Advent Calender ver.)
ユーザー ecottea
提出日時 2024-12-08 18:38:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,884 ms / 3,340 ms
コード長 55,276 bytes
コンパイル時間 5,872 ms
コンパイル使用メモリ 291,916 KB
最終ジャッジ日時 2025-02-26 11:36:19
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#ifndef HIDDEN_IN_VS //
//
#define _CRT_SECURE_NO_WARNINGS
//
#include <bits/stdc++.h>
using namespace std;
//
using ll = long long; using ull = unsigned long long; // -2^63 2^63 = 9e18int -2^31 2^31 = 2e9
using pii = pair<int, int>; using pll = pair<ll, ll>; using pil = pair<int, ll>; using pli = pair<ll, int>;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using vvvvi = vector<vvvi>;
using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>; using vvvvl = vector<vvvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
template <class T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
using Graph = vvi;
//
const double PI = acos(-1);
int DX[4] = { 1, 0, -1, 0 }; // 4
int DY[4] = { 0, 1, 0, -1 };
int INF = 1001001001; ll INFL = 4004004003094073385LL; // (int)INFL = INF, (int)(-INFL) = -INF;
//
struct fast_io { fast_io() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } fastIOtmp;
//
#define all(a) (a).begin(), (a).end()
#define sz(x) ((int)(x).size())
#define lbpos(a, x) (int)distance((a).begin(), std::lower_bound(all(a), (x)))
#define ubpos(a, x) (int)distance((a).begin(), std::upper_bound(all(a), (x)))
#define Yes(b) {cout << ((b) ? "Yes\n" : "No\n");}
#define rep(i, n) for(int i = 0, i##_len = int(n); i < i##_len; ++i) // 0 n-1
#define repi(i, s, t) for(int i = int(s), i##_end = int(t); i <= i##_end; ++i) // s t
#define repir(i, s, t) for(int i = int(s), i##_end = int(t); i >= i##_end; --i) // s t
#define repe(v, a) for(const auto& v : (a)) // a
#define repea(v, a) for(auto& v : (a)) // a
#define repb(set, d) for(int set = 0, set##_ub = 1 << int(d); set < set##_ub; ++set) // d
#define repis(i, set) for(int i = lsb(set), bset##i = set; i < 32; bset##i -= 1 << i, i = lsb(bset##i)) // set
#define repp(a) sort(all(a)); for(bool a##_perm = true; a##_perm; a##_perm = next_permutation(all(a))) // a
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());} //
#define EXIT(a) {cout << (a) << endl; exit(0);} //
#define inQ(x, y, u, l, d, r) ((u) <= (x) && (l) <= (y) && (x) < (d) && (y) < (r)) //
//
template <class T> inline ll powi(T n, int k) { ll v = 1; rep(i, k) v *= n; return v; }
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // true
    
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // true
    
template <class T> inline T getb(T set, int i) { return (set >> i) & T(1); }
template <class T> inline T smod(T n, T m) { n %= m; if (n < 0) n += m; return n; } // mod
//
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repea(x, v) is >> x; return is; }
template <class T> inline vector<T>& operator--(vector<T>& v) { repea(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repea(x, v) ++x; return v; }
#endif //
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#ifdef _MSC_VER
#include "localACL.hpp"
#endif
//using mint = modint998244353;
//using mint = static_modint<1000000007>;
using mint = modint; // mint::set_mod(m);
namespace atcoder {
inline istream& operator>>(istream& is, mint& x) { ll x_; is >> x_; x = x_; return is; }
inline ostream& operator<<(ostream& os, const mint& x) { os << x.val(); return os; }
}
using vm = vector<mint>; using vvm = vector<vm>; using vvvm = vector<vvm>; using vvvvm = vector<vvvm>; using pim = pair<int, mint>;
#endif
#ifdef _MSC_VER // Visual Studio
#include "local.hpp"
#else // gcc
inline int popcount(int n) { return __builtin_popcount(n); }
inline int popcount(ll n) { return __builtin_popcountll(n); }
inline int lsb(int n) { return n != 0 ? __builtin_ctz(n) : 32; }
inline int lsb(ll n) { return n != 0 ? __builtin_ctzll(n) : 64; }
inline int msb(int n) { return n != 0 ? (31 - __builtin_clz(n)) : -1; }
inline int msb(ll n) { return n != 0 ? (63 - __builtin_clzll(n)) : -1; }
#define dump(...)
#define dumpel(...)
#define dump_list(v)
#define dump_mat(v)
#define input_from_file(f)
#define output_to_file(f)
#define Assert(b) { if (!(b)) { vc MLE(1<<30); EXIT(MLE.back()); } } // RE MLE
#endif
//mint →
/*
* x v_max
*/
string mint_to_frac(mint x, int v_max = 31595) {
// verify : https://www.codechef.com/problems/SUMOVERALL
repi(dnm, 1, v_max) {
int num = (x * dnm).val();
if (num == 0) {
return "0";
}
if (num <= v_max) {
if (dnm == 1) return to_string(num);
return to_string(num) + "/" + to_string(dnm);
}
if (mint::mod() - num <= v_max) {
if (dnm == 1) return "-" + to_string(mint::mod() - num);
return "-" + to_string(mint::mod() - num) + "/" + to_string(dnm);
}
}
return to_string(x.val());
}
//
void WA() {
int h, w; ll k; int m;
cin >> h >> w >> k >> m;
mint::set_mod(m);
dump(mint_to_frac(499122177));
dump(mint_to_frac(249561091)); // 11/4
dump(0 + 1 + 1 + 1 + (1 + 1) + 4 + 4 + 9);
int n = h * w;
vm pow_i(n + 1);
repi(i, 0, n) pow_i[i] = mint(i).pow(k);
mint res = 0;
repb(set, n) {
dsu d(n); mint val = 0;
rep(i, h) rep(j, w - 1) {
if (!getb(set, i * w + j)) continue;
if (!getb(set, i * w + (j + 1))) continue;
d.merge(i * w + j, i * w + (j + 1));
}
rep(i, h - 1) rep(j, w) {
if (!getb(set, i * w + j)) continue;
if (!getb(set, (i + 1) * w + j)) continue;
d.merge(i * w + j, (i + 1) * w + j);
}
auto gs = d.groups();
repe(g, gs) {
if (sz(g) == 1 && !getb(set, g[0])) continue;
val += pow_i[sz(g)];
}
// dump(set, val);
res += val;
}
res /= mint(2).pow(n);
EXIT(res);
}
//mint
/*
* Pow_mint(mint B, int n) : O(n)
* B B^0 B^n
*
* build_neg() : O(n)
* B^(-1) B^(-n)
* : B mint
*
* mint [](int i) : O(1)
* B^i
*/
class Pow_mint {
int n;
vm powB, powB_inv;
public:
Pow_mint(mint B, int n) : n(max(n, 2)) {
// verify : https://yukicoder.me/problems/no/2709
// B
powB.resize(n + 1);
powB[0] = 1;
rep(i, n) powB[i + 1] = powB[i] * B;
};
Pow_mint() : n(0) {}
//
void build_neg() {
// verify : https://atcoder.jp/contests/arc116/tasks/arc116_b
// B
mint invB = powB[1].inv();
powB_inv.resize(n + 1);
powB_inv[0] = 1;
rep(i, n) powB_inv[i + 1] = powB_inv[i] * invB;
}
// B^i
mint const& operator[](int i) const {
// verify : https://atcoder.jp/contests/arc116/tasks/arc116_b
Assert(abs(i) <= n);
return i >= 0 ? powB[i] : powB_inv[-i];
}
#ifdef _MSC_VER
friend ostream& operator<<(ostream& os, const Pow_mint& pw) {
os << pw.powB << endl;
os << pw.powB_inv << endl;
return os;
}
#endif
};
// AC51, TLE16
mint TLE(int h, int w, ll k, int m) {
mint::set_mod(m);
int n = h * w;
vm pow_i(n + 1);
repi(i, 0, n) pow_i[i] = mint(i).pow(k);
vvm bin(n + 1, vm(n + 1));
bin[0][0] = 1;
repi(i, 1, n) repi(j, 0, i) {
if (j > 0) bin[i][j] += bin[i - 1][j - 1];
if (j < i) bin[i][j] += bin[i - 1][j];
}
vvm bin_inv(n + 1, vm(n + 1));
repi(i, 0, n) repi(j, 0, i) {
bin_inv[i][j] = bin[i][j].inv();
}
Pow_mint pow2(2, n);
pow2.build_neg();
vm inv(n + 1);
repi(i, 1, n) inv[i] = mint(i).inv();
mint res = 0;
// bit DP
repb(set, n) {
if (set == 0) continue;
vvi a(h, vi(w));
rep(i, h) rep(j, w) a[i][j] = getb(set, i * w + j);
dsu d(n); int x0 = 0, y0 = 0;
rep(i, h) rep(j, w - 1) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i][j + 1]) continue;
d.merge(i * w + j, i * w + (j + 1));
}
rep(i, h - 1) rep(j, w) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i + 1][j]) continue;
d.merge(i * w + j, (i + 1) * w + j);
}
int pc = popcount(set);
if (d.size(x0 * w + y0) != pc) continue;
rep(i, h) {
rep(j, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j + 1] == 1) a[i][j] = -1;
}
repi(j, 1, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j - 1] == 1) a[i][j] = -1;
}
}
rep(j, w) {
rep(i, h - 1) {
if (a[i][j] != 0) continue;
if (a[i + 1][j] == 1) a[i][j] = -1;
}
repi(i, 1, h - 1) {
if (a[i][j] != 0) continue;
if (a[i - 1][j] == 1) a[i][j] = -1;
}
}
int cnt = 0;
rep(i, h) rep(j, w) cnt += a[i][j] != 0;
repi(k, 1, n) {
mint p0 = bin_inv[n][k] * pow2[-k];
mint w1 = pow2[k - cnt] * bin[n][k] * inv[n - k + 1];
res += p0 * w1 * pow_i[pc];
}
}
return res;
}
//
/*
* Frac<T>() : O(1)
* 0
* T int, ll, __int128, boost::multiprecision::int256_t
*
* Frac<T>(T num) : O(1)
* num
*
* Frac<T>(T num, T dnm) : O(1)
* num / dnm
*
* a == b, a != b, a < b, a > b, a <= b, a >= b : O(1)
*
*
* a + b, a - b, a * b, a / b : O(1)
*
* 使
*
* reduction() : O(log min(num, dnm))
*
*
* together(Frac& a, Frac& b) : O(log min(a.dnm, b.dnm))
* a b
*
* together(vector<Frac>& as) : O(|as| log dnm)
* as
*
* T floor() : O(1)
* floor
*
* T ceil() : O(1)
* ceil
*
* bool integerQ() : O(1)
*
*/
template <class T = ll>
struct Frac {
//
T num, dnm;
//
Frac() : num(0), dnm(1) {}
Frac(T num) : num(num), dnm(1) {}
Frac(T num_, T dnm_) : num(num_), dnm(dnm_) {
// verify : https://atcoder.jp/contests/abc244/tasks/abc244_h
Assert(dnm != 0);
if (dnm < 0) { num *= -1; dnm *= -1; }
}
//
Frac(const Frac& b) = default;
Frac& operator=(const Frac& b) = default;
//
operator double() const { return (double)num / (double)dnm; }
//
bool operator==(const Frac& b) const {
//
if (dnm == b.dnm) return num == b.num;
return num * b.dnm == b.num * dnm;
}
bool operator!=(const Frac& b) const { return !(*this == b); }
bool operator<(const Frac& b) const {
// verify : https://atcoder.jp/contests/abc308/tasks/abc308_c
//
if (dnm == b.dnm) return num < b.num;
return (num * b.dnm < b.num * dnm);
}
bool operator>=(const Frac& b) const { return !(*this < b); }
bool operator>(const Frac& b) const { return b < *this; }
bool operator<=(const Frac& b) const { return !(*this > b); }
//
bool operator==(T b) const { return num == b * dnm; }
bool operator!=(T b) const { return num != b * dnm; }
bool operator<(T b) const { return num < b * dnm; }
bool operator>=(T b) const { return num >= b * dnm; }
bool operator>(T b) const { return num > b * dnm; }
bool operator<=(T b) const { return num <= b * dnm; }
friend bool operator==(T a, const Frac& b) { return a * b.dnm == b.num; }
friend bool operator!=(T a, const Frac& b) { return a * b.dnm != b.num; }
friend bool operator<(T a, const Frac& b) { return a * b.dnm < b.num; }
friend bool operator>=(T a, const Frac& b) { return a * b.dnm >= b.num; }
friend bool operator>(T a, const Frac& b) { return a * b.dnm > b.num; }
friend bool operator<=(T a, const Frac& b) { return a * b.dnm <= b.num; }
//
Frac& operator+=(const Frac& b) {
// verify : https://www.codechef.com/problems/ARCTR
//
if (dnm == b.dnm) num += b.num;
else { num = num * b.dnm + b.num * dnm; dnm *= b.dnm; }
return *this;
}
Frac& operator-=(const Frac& b) {
// verify : https://www.codechef.com/problems/ARCTR
//
if (dnm == b.dnm) num -= b.num;
else { num = num * b.dnm - b.num * dnm; dnm *= b.dnm; }
return *this;
}
Frac& operator*=(const Frac& b) { num *= b.num; dnm *= b.dnm; return *this; }
Frac& operator/=(const Frac& b) {
// verify : https://atcoder.jp/contests/abc301/tasks/abc301_g
Assert(b.num != 0);
num *= b.dnm; dnm *= b.num;
if (dnm < 0) { num *= -1; dnm *= -1; }
return *this;
}
Frac operator+(const Frac& b) const { Frac a = *this; return a += b; }
Frac operator-(const Frac& b) const { Frac a = *this; return a -= b; }
Frac operator*(const Frac& b) const { Frac a = *this; return a *= b; }
Frac operator/(const Frac& b) const { Frac a = *this; return a /= b; }
Frac operator-() const { return Frac(*this) *= Frac(-1); }
//
Frac& operator+=(T c) { num += dnm * c; return *this; }
Frac& operator-=(T c) { num -= dnm * c; return *this; }
Frac& operator*=(T c) { num *= c; return *this; }
Frac& operator/=(T c) {
Assert(c != T(0));
dnm *= c;
if (dnm < 0) { num *= -1; dnm *= -1; }
return *this;
}
Frac operator+(T c) const { Frac a = *this; return a += c; }
Frac operator-(T c) const { Frac a = *this; return a -= c; }
Frac operator*(T c) const { Frac a = *this; return a *= c; }
Frac operator/(T c) const { Frac a = *this; return a /= c; }
friend Frac operator+(T c, const Frac& a) { return a + c; }
friend Frac operator-(T c, const Frac& a) { return Frac(c) - a; }
friend Frac operator*(T c, const Frac& a) { return a * c; }
friend Frac operator/(T c, const Frac& a) { return Frac(c) / a; }
//
void reduction() {
// verify : https://atcoder.jp/contests/abc229/tasks/abc229_h
auto g = gcd(num, dnm);
num /= g; dnm /= g;
}
// a b
friend void together(Frac& a, Frac& b) {
// verify : https://atcoder.jp/contests/abc229/tasks/abc229_h
T dnm = lcm(a.dnm, b.dnm);
a.num *= dnm / a.dnm; a.dnm = dnm;
b.num *= dnm / b.dnm; b.dnm = dnm;
}
// as
friend void together(vector<Frac>& as) {
// verify : https://yukicoder.me/problems/617
T dnm = 1;
repe(a, as) dnm = lcm(dnm, a.dnm);
repea(a, as) {
a.num *= dnm / a.dnm;
a.dnm = dnm;
}
}
// floor
T floor() const {
// verify : https://www.codechef.com/problems/LINEFIT?tab=statement
if (num >= 0) return num / dnm;
else return -((-num + dnm - 1) / dnm);
}
// ceil
T ceil() const {
// verify : https://www.codechef.com/problems/LINEFIT?tab=statement
if (num >= 0) return (num + dnm - 1) / dnm;
else return -((-num) / dnm);
}
//
bool integerQ() const {
// verify : https://atcoder.jp/contests/ttpc2022/tasks/ttpc2022_g
return num % dnm == 0;
}
#ifdef _MSC_VER
friend ostream& operator<<(ostream& os, const Frac& a) { os << a.num << '/' << a.dnm; return os; }
#endif
};
using F = Frac<ll>;
vector<F> umekomi_sub(int h, int w) {
int n = h * w;
vvl bin(n + 1, vl(n + 1));
bin[0][0] = 1;
repi(i, 1, n) repi(j, 0, i) {
if (j > 0) bin[i][j] += bin[i - 1][j - 1];
if (j < i) bin[i][j] += bin[i - 1][j];
}
vector<F> coef(n + 1);
repb(set, n) {
if (set == 0) continue;
vvi a(h, vi(w));
rep(i, h) rep(j, w) a[i][j] = getb(set, i * w + j);
dsu d(n); int x0 = 0, y0 = 0;
rep(i, h) rep(j, w - 1) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i][j + 1]) continue;
d.merge(i * w + j, i * w + (j + 1));
}
rep(i, h - 1) rep(j, w) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i + 1][j]) continue;
d.merge(i * w + j, (i + 1) * w + j);
}
int pc = popcount(set);
if (d.size(x0 * w + y0) != pc) continue;
rep(i, h) {
rep(j, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j + 1] == 1) a[i][j] = -1;
}
repi(j, 1, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j - 1] == 1) a[i][j] = -1;
}
}
rep(j, w) {
rep(i, h - 1) {
if (a[i][j] != 0) continue;
if (a[i + 1][j] == 1) a[i][j] = -1;
}
repi(i, 1, h - 1) {
if (a[i][j] != 0) continue;
if (a[i - 1][j] == 1) a[i][j] = -1;
}
}
int cnt = 0;
rep(i, h) rep(j, w) cnt += a[i][j] != 0;
repi(t, 1, n) {
coef[pc] += F(1, (ll)(n - t + 1) << cnt);
coef[pc].reduction();
}
}
return coef;
}
int N = 25;
void umekomi() {
cout << "vvl coef = {" << endl;
repi(h, 1, N) repi(w, 1, min(N / h, h)) {
dump(h, w);
auto c = umekomi_sub(h, w);
int n = sz(c);
cout << "{";
rep(i, n) {
cout << c[i].num << "," << c[i].dnm << ",}"[i == n - 1];
}
cout << "," << endl;
}
cout << "};" << endl;
}
//
vvl coef = {
//
};
//
mint WA(int h0, int w0, ll k, int m) {
mint::set_mod(m);
if (h0 < w0) swap(h0, w0);
int pt = 0;
repi(h, 1, N) repi(w, 1, min(N / h, h)) {
if (h == h0 && w == w0) {
auto c = coef[pt];
mint res = 0;
rep(t, sz(c) / 2) {
res += mint(t).pow(k) * c[2 * t + 0] / c[2 * t + 1];
}
return res;
}
pt++;
}
return -1;
}
vector<vector<F>> umekomi2_sub(int h, int w) {
int n = h * w;
vvl bin(n + 1, vl(n + 1));
bin[0][0] = 1;
repi(i, 1, n) repi(j, 0, i) {
if (j > 0) bin[i][j] += bin[i - 1][j - 1];
if (j < i) bin[i][j] += bin[i - 1][j];
}
vector<vector<F>> coef(n + 1, vector<F>(n + 1));
repb(set, n) {
if (set == 0) continue;
vvi a(h, vi(w));
rep(i, h) rep(j, w) a[i][j] = getb(set, i * w + j);
dsu d(n); int x0 = 0, y0 = 0;
rep(i, h) rep(j, w - 1) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i][j + 1]) continue;
d.merge(i * w + j, i * w + (j + 1));
}
rep(i, h - 1) rep(j, w) {
if (!a[i][j]) continue;
x0 = i, y0 = j;
if (!a[i + 1][j]) continue;
d.merge(i * w + j, (i + 1) * w + j);
}
int pc = popcount(set);
if (d.size(x0 * w + y0) != pc) continue;
rep(i, h) {
rep(j, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j + 1] == 1) a[i][j] = -1;
}
repi(j, 1, w - 1) {
if (a[i][j] != 0) continue;
if (a[i][j - 1] == 1) a[i][j] = -1;
}
}
rep(j, w) {
rep(i, h - 1) {
if (a[i][j] != 0) continue;
if (a[i + 1][j] == 1) a[i][j] = -1;
}
repi(i, 1, h - 1) {
if (a[i][j] != 0) continue;
if (a[i - 1][j] == 1) a[i][j] = -1;
}
}
int cnt = 0;
rep(i, h) rep(j, w) cnt += a[i][j] != 0;
repi(t, 1, n) {
coef[pc][n - t + 1] += F(1, 1LL << cnt);
coef[pc][n - t + 1].reduction();
}
}
return coef;
}
int N2 = 25;
void umekomi2() {
cout << "vvl coef2 = {" << endl;
repi(h, 1, N2) repi(w, 1, min(N2 / h, h)) {
if (h * w <= 21) continue;
dump(h, w);
auto c = umekomi2_sub(h, w);
int n = h * w;
cout << "{";
repi(i, 0, n) repi(j, 1, n) {
cout << c[i][j].num << "," << msb(c[i][j].dnm) << ",}"[i == n && j == n];
}
cout << "," << endl;
}
cout << "};" << endl;
}
vvl coef2 = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49
    ,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,49,5,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33
    ,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,33,6,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351
    ,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,351,10,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11
    ,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,473,11,1367,13,1367,13,1367,13
    ,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13,1367,13
    ,1367,13,1367,13,1367,13,1367,13,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15
    ,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,4259,15,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18
    ,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18,27847,18
    ,27847,18,27847,18,27847,18,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985
    ,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,188985,21,162693,21
    ,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21
    ,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,162693,21,70785,20,70785,20,70785,20,70785,20,70785,20
    ,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20,70785,20
    ,70785,20,70785,20,70785,20,70785,20,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987
    ,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24,985987,24
    ,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24
    ,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,851699,24,362115,23,362115,23,362115,23
    ,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23
    ,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,362115,23,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24
    ,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24,597493,24
    ,597493,24,597493,24,597493,24,597493,24,597493,24,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23
    ,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23,234759,23
    ,234759,23,234759,23,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25
    ,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,687581,25,113613,23
    ,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23
    ,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,113613,23,129157,24,129157,24,129157,24,129157,24
    ,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24
    ,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,129157,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24
    ,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24,59591,24
    ,59591,24,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25
    ,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,42437,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25
    ,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25,11295,25
    ,11295,25,11295,25,11295,25,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137
    ,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,137,21,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22
    ,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,37,22,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
    ,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1
    ,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1
    ,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7,65,7
    ,65,7,65,7,65,7,65,7,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173,9,173
    ,9,173,9,173,9,173,9,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883
    ,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,1883,13,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12
    ,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,699,12,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941
    ,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,8941,16,7297
    ,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297,16,7297
    ,16,7297,16,7297,16,7297,16,7297,16,7297,16,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21
    ,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21,194155,21
    ,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20
    ,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,81199,20,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23
    ,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23,545325,23
    ,545325,23,545325,23,545325,23,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365
    ,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,14365,18,774295,24,774295,24,774295,24,774295,24
    ,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24
    ,774295,24,774295,24,774295,24,774295,24,774295,24,774295,24,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21
    ,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,80375,21,129493,22
    ,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22
    ,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,129493,22,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20
    ,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20,24659,20
    ,24659,20,24659,20,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893
    ,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,274893,24,20933,21,20933,21,20933,21
    ,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21,20933,21
    ,20933,21,20933,21,20933,21,20933,21,20933,21,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23
    ,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,41947,23,8123,22,8123,22,8123,22
    ,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22,8123,22
    ,8123,22,8123,22,8123,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22
    ,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,2329,22,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17
    ,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15,17,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20
    ,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3
    ,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1
    ,24,1,24,1,24,1,24,1,24},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25
    ,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8
    ,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,137,8,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47
    ,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,47,7,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455
    ,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,4455,14,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16
    ,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16,13819,16
    ,13819,16,13819,16,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781
    ,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,171781,20,267005,21,267005,21,267005,21
    ,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21
    ,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,267005,21,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625
    ,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625,24,1652625
    ,24,1652625,24,1652625,24,1652625,24,1652625,24,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897
    ,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23,634897,23
    ,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24
    ,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,973997,24,373181,23,373181,23,373181,23,373181,23
    ,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23
    ,373181,23,373181,23,373181,23,373181,23,373181,23,373181,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23
    ,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23,287421,23
    ,287421,23,287421,23,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22
    ,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,111507,22,347449,24,347449,24
    ,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24
    ,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,347449,24,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21
    ,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21,33255,21
    ,33255,21,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23
    ,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,96161,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23
    ,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23,62075,23
    ,62075,23,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24
    ,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,66909,24,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21
    ,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,3509,21,4327,23,4327,23
    ,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23,4327,23
    ,4327,23,4327,23,4327,23,4327,23,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22
    ,469,22,469,22,469,22,469,22,469,22,469,22,469,22,469,22,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17
    ,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,17,20,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3
    ,21,3,21,3,21,3,21,3,21,3,21,3,21,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1
    ,24,1,24},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3
    ,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6,41,6
    ,41,6,41,6,41,6,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,67,7,91,8,91,8,91,8,91,8
    ,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,91,8,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485
    ,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,485,11,335,11,335,11,335,11,335,11,335,11,335,11
    ,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,335,11,3603,15,3603,15,3603,15,3603,15
    ,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15,3603,15
    ,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16,4873,16
    ,4873,16,4873,16,4873,16,4873,16,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19
    ,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,26177,19,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187
    ,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,2187,16,11631,19,11631,19
    ,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19,11631,19
    ,11631,19,11631,19,11631,19,11631,19,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10,15,10
    ,15,10,15,10,15,10,15,10,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19
    ,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,5041,19,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18
    ,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,1655,18,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19
    ,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,2203,19,1459,19,1459,19,1459,19
    ,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19,1459,19
    ,1459,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869,19,869
    ,19,869,19,869,19,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22
    ,3217,22,3217,22,3217,22,3217,22,3217,22,3217,22,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511
    ,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,511,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21
    ,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,101,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11
    ,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,11,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1
    ,22,1,22,1,22,1,22,1,22},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2
    ,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,7,2,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4
    ,11,4,11,4,11,4,11,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,9,4,197,9,197,9,197,9,197,9,197
    ,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,197,9,263,10,263,10,263,10,263,10
    ,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,263,10,1461
    ,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461,13,1461
    ,13,1461,13,1461,13,1461,13,1461,13,1461,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987
    ,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,987,13,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739
    ,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,10739,17,14517
    ,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517
    ,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,14517,18,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193
    ,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,78193,21,26213
    ,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213
    ,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,26213,20,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957
    ,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,34957,21,5793
    ,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793,19,5793
    ,19,5793,19,5793,19,5793,19,5793,19,5793,19,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21
    ,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,15261,21,5007,20,5007,20,5007,20
    ,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20,5007,20
    ,5007,20,5007,20,5007,20,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21
    ,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,6611,21,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17
    ,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,275,17,1401,20,1401,20,1401,20,1401,20,1401,20,1401
    ,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401,20,1401
    ,20,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95,17,95
    ,17,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967
    ,24,4967,24,4967,24,4967,24,4967,24,4967,24,4967,24,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22
    ,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,347,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22
    ,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,61,22,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3
    ,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1
    ,24,1,24,1,24,1,24,1,24,1,24},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0
    ,3,0,3,0,3,0,3,0,3,0,3,0,3,0,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,23,4,11,4
    ,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,11,4,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6
    ,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,21,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
    ,5,5,5,5,5,5,5,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,19,8,9,8,9,8,9,8,9,8,9,8
    ,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,9,8,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17
    ,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,17,10,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7
    ,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,15,12,7,12,7,12,7
    ,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,7,12,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13
    ,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3
    ,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16,11,16
    ,11,16,11,16,11,16,11,16,11,16,11,16,11,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5,16,5
    ,16,5,16,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,9,18,1,16,1,16,1,16,1,16,1,16,1
    ,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7
    ,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,7,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3,20,3
    ,20,3,20,3,20,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,5,22,1,21,1,21,1,21,1,21,1
    ,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1
    ,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3
    ,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,25,3,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1
    ,3,1,3,1,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,11,5,11,5,11,5,11,5
    ,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,11,5,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7
    ,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6,5,6
    ,5,6,5,6,5,6,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,9,9,9,9,9,9,9,9,9
    ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17
    ,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8
    ,1,8,1,8,1,8,1,8,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15
    ,13,15,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,7,13,13,15,13,15,13,15,13
    ,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,13,15,3,14,3,14,3,14,3,14,3,14,3
    ,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11
    ,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,11,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5
    ,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,5,17,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9,19,9
    ,19,9,19,9,19,9,19,9,19,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,7,21,7
    ,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,7,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3
    ,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,3,21,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5
    ,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,5,23,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1
    ,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13
    ,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,13,2,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25
    ,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,25,4,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,23,6
    ,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,23,6,11,6,11,6,11,6,11,6,11,6,11,6
    ,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,11,6,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8
    ,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,21,8,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7,5,7
    ,5,7,5,7,5,7,5,7,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19,10,19
    ,10,19,10,19,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,17,12,17
    ,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,17,12,1,9,1,9,1
    ,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15
    ,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7
    ,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,7,14,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13
    ,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,13,16,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,3
    ,15,3,15,3,15,3,15,3,15,3,15,3,15,3,15,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11,18,11
    ,18,11,18,11,18,11,18,11,18,11,18,11,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18,5,18
    ,5,18,5,18,5,18,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,9,20,1,18,1,18
    ,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,7,22,7,22,7,22,7,22,7,22,7,22,7,22
    ,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,7,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22
    ,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,3,22,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24,5,24
    ,5,24,5,24,5,24,5,24,5,24,5,24,5,24,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23
    ,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27
    ,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,27,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13
    ,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,13,3,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25
    ,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,23,7,23
    ,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,11,7,11,7,11,7,11,7,11,7,11
    ,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21
    ,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8
    ,5,8,5,8,5,8,5,8,5,8,5,8,5,8,5,8,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19
    ,11,19,11,19,11,19,11,19,11,19,11,19,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11,9,11
    ,9,11,9,11,9,11,9,11,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17
    ,13,17,13,17,13,17,13,17,13,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1
    ,10,1,10,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
    ,15,15,15,15,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,7,15,13
    ,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13,17,13
    ,17,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,3,16,11,19,11,19,11
    ,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,11,19,5,19,5,19
    ,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,5,19,9,21,9,21,9,21,9,21,9,21,9,21
    ,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,9,21,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19
    ,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23
    ,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,7,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23,3,23
    ,3,23,3,23,3,23,3,23,3,23,3,23,3,23,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25,5,25
    ,5,25,5,25,5,25,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,25
    ,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25}
};
mint solve(int h0, int w0, ll k, int m) {
if (h0 * w0 <= 21) return TLE(h0, w0, k, m);
mint::set_mod(m);
if (h0 < w0) swap(h0, w0);
int pt = 0;
repi(h, 1, N) repi(w, 1, min(N / h, h)) {
if (h * w <= 21) continue;
if (h == h0 && w == w0) {
auto c = coef2[pt];
int n = h * w;
mint res = 0; pt = 0;
repi(i, 0, n) repi(j, 1, n) {
mint val = mint(i).pow(k);
val *= c[pt++];
val /= 1LL << c[pt++];
val /= j;
res += val;
}
return res;
}
pt++;
}
return -1;
}
int main() {
input_from_file("input.txt");
output_to_file("output.txt");
// umekomi2(); return 0;
int h, w; ll k; int m;
cin >> h >> w >> k >> m;
dump(TLE(h, w, k, m));
EXIT(solve(h, w, k, m));
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0