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

template <class operator_monoid> class dual_segment_tree{
public:
	typedef typename operator_monoid::underlying_type underlying_type;
	typedef typename operator_monoid::value_type value_type;
	size_t n;
	vector<underlying_type> v;
	vector<value_type> w;
	underlying_type e = operator_monoid::unit();
	dual_segment_tree(size_t size){
		n = 1;
		while(n < size) n <<= 1;
		v.resize(2*n, e);
		w.resize(size, operator_monoid::default_value());
	}
	dual_segment_tree(vector<value_type> _w){
		size_t size = w.size();
		n = 1;
		while(n < size) n <<= 1;
		v.resize(2*n, e);
		w(_w);
	}
	void range_operate(underlying_type f, size_t a, size_t b, size_t k, size_t l, size_t r){
		if(r <= a || b <= l) return;
		if(a <= l && r <= b) v[k] = operator_monoid::compose(f, v[k]);
		else{
			if(2*k < v.size())
				v[2*k] = operator_monoid::compose(v[k], v[2*k]);
			if(2*k+1 < v.size())
				v[2*k+1] = operator_monoid::compose(v[k], v[2*k+1]);
			v[k] = operator_monoid::unit();
			range_operate(f, a, b, 2*k, l, (l+r+1)/2);
			range_operate(f, a, b, 2*k+1, (l+r+1)/2, r);
		}
	}
	void range_operate(underlying_type f, size_t a, size_t b){
		range_operate(f, a, b, 1, 0, n);
	}
	value_type point_get(size_t i){
		range_operate(e, i, i+1, 1, 0, n);
		return operator_monoid::operate(v[i+n], w[i]);
	}
};
struct assign_operator_monoid{
	using underlying_type = pair<bool, Int>;
	using value_type = Int;
	static underlying_type unit(){
		return pair<bool, int>(true, 0);
	}
	static underlying_type compose(underlying_type l, underlying_type r){
		if(l == unit()) return r;
		return l;
	}
	static value_type default_value(){
		return (1ll<<31)-1;
	}
	static value_type operate(underlying_type f, value_type x){
		return f.first ? x : f.second;
	}
};

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	Int n, q; cin >> n >> q;
	dual_segment_tree<assign_operator_monoid> dst(n);
	while(q--){
		Int p; cin >> p;
		if(p == 0){
			Int s, t, x; cin >> s >> t >> x;
			dst.range_operate(pair<bool, Int>(false, x), s, t+1);
		}else{
			Int i; cin >> i;
			cout << dst.point_get(i) << "\n";
//			if(i == 5)
//				for(Int j=0; j<64; ++j)
//					cout << j << " " << (dst.v[j].first ? "id" : "no") << " " << dst.v[j].second << "\n";
		}
	}
}

#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int n, q, s, t, x, u;
iP a[1<<18];
bool b;

int update(int s, int t, int x, int k, int l, int r, int i) {
	if (t < l || r < s)return 0;
	else if (s <= l&&r <= t) {
		a[k] = mkp(x, i);
		return 0;
	}
	else {
		update(s, t, x, k * 2, l, (l + r) / 2, i);
		update(s, t, x, k * 2 + 1, (l + r) / 2 + 1, r, i);
		return 0;
	}
}
int find(int x) {
	int y, z = -2;
	x += u;
	while (x) {
		if (z < a[x].second) {
			y = a[x].first;
			z = a[x].second;
		}
		x /= 2;
	}
	return y;
}

int main(){
	cin >> n >> q;
	for (int i = 1;; ++i) {
		if ((1 << i) / n >= 2) {
			u = (1 << i - 1);
			break;
		}
	}
	for (int i = 1; i != u * 2; ++i)
		a[i] = mkp(intmax, -1);
	for (int i = 0; i != q; ++i) {
		cin >> b >> s;
		if (b) {
			cout << find(s) << endl;
		}
		else {
			cin >> t >> x;
			update(s, t, x, 1, 0, u - 1, i);
		}
	}
	return 0;
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long inf = numeric_limits<long long>::max();
typedef long long ll;

ll calc(vector<ll> & vec, ll mode, ll add) {
  ll ans = 0;
  rep(i, vec.size()) {
    if (add ) {

    }
    if (vec[i] > 0 && mode != i) {
      ans += 1;
    }
  }
  return ans;
}

bool sortbysec(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second > b.second);
}

vector<pair<ll, ll>> convert(vector<ll> &vec) {
  vector<pair<ll, ll>> seq;
  rep(i, vec.size()) {
    if (vec[i] == 0) {
      continue;
    }
    seq.push_back(make_pair((ll)i, vec[i]));
  }
  sort(seq.begin(), seq.end(), sortbysec);
  return seq;
}

int main()
{
  int n;
  cin >> n;
  vector<ll> vec_even(pow(10, 5)+10, 0);
  vector<ll> vec_odd(pow(10, 5)+10, 0);
  int even_size = 0;
  int odd_size = 0;
  rep(i, n) {
    int x;
    cin >> x;
    if (i%2 == 0) {
      even_size++;
      vec_even[x]++;
    } else {
      odd_size++;
      vec_odd[x]++;
    }
  }
  vector<pair<ll, ll>> even_pairs = convert(vec_even);
  vector<pair<ll, ll>> odd_pairs = convert(vec_odd);
  ll res = pow(10, 8);
  if (even_pairs[0].first == odd_pairs[0].first) {
    ll a, b;
    a = even_size - even_pairs[0].second;
    b = odd_size - (odd_pairs.size() == 1 ? 0 : (odd_pairs[1].second));
    res = min(res, a + b);

    a = odd_size - odd_pairs[0].second;
    b = even_size - (even_pairs.size() == 1 ? 0 : (even_pairs[1].second));
    res = min(res, a + b);
  } else {
    ll a = even_size - even_pairs[0].second;
    ll b = odd_size - odd_pairs[0].second;
    res = a + b;
  }
  cout << res << endl;
  return 0;
}


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

int main(){

  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  bool x = true;

  if( e-a>k || e-b>k || e-c>k || e-d>k || d-a>k || d-b>k || d-c>k || c-a>k || c-b>k || b-a>k ){

    x = false;

  }

  if( x ){

    cout << "Yay!" << endl;

  }

  else{

    cout << ":(" << endl;

  }

}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  cout << (H2 - H1) * 60 + M2 - M1 - K << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int f(int n)
{
    return ((n & 1) ? 3 * n + 1 : n / 2);
}

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

    cout << (n + 110) / 111 * 111 << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
const int mod=1000000007,MAX=200005,INF=1<<30;

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

  	if(n%111==0){
    	cout<<n<<endl;
    }

  	else{
    	n+=111-(n%111);
      	cout<<n<<endl;
    }

}


#include<bits/stdc++.h>

#define oo ll(1e16)
#define maxn 200005
#define block 400

using namespace std;
typedef long long ll;

int n, q, a, b;
ll d[maxn];
ll L[maxn], R[maxn];

ll ret = 0;

ll get(int st, int en, int ok) {
  ll ret = oo;

  for (int i = st; i <= en;)
    if (i % block == 1 && i + block <= en + 1) {
      ret = min(ret, (ok ? L[(i - 1) / block] : R[(i - 1) / block]));
      i += block;
    }
    else {
      ret = min(ret, d[i] + (ok ? -i : i));
      ++i;
    }

  return ret;
}

int main(){
  ios_base::sync_with_stdio(0);

  cin >> n >> q >> a >> b;

  fill(d + 1, d + n + 1, oo);
  fill(L, L + n + 1, oo);
  fill(R, R + n + 1, oo);

  d[b] = 0;
  L[(b - 1) / block] = -b;
  R[(b - 1) / block] = b;

  while (q--) {
    int x;
    cin >> x;

    ll tem = min(get(1, x, 1) + x, get(x, n, 0) - x);

    d[a] = min(d[a], tem - abs(x - a));

    int bl = (a - 1) / block;

    L[bl] = oo;
    R[bl] = oo;

    for (int i = max(bl * block + 1, 1); i <= bl * block + block && i <= n; ++i) {
      L[bl] = min(L[bl], d[i] - i);
      R[bl] = min(R[bl], d[i] + i);
    }

    ret += abs(x - a);

   // for (int i = 1; i <= n; ++i) cerr << d[i] + ret << ' '; cerr << "\n\n";

    a = x;
  }

  ll ma = 0;
  for (int i = 1; i <= n; ++i)
    ma = min(ma, d[i]);

  cout << ma + ret;

  return 0;

}

// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

template <typename _tp> inline void read(_tp&x){
	char ch=getchar(),ob=0;x=0;
	while(ch!='-'&&!isdigit(ch))ch=getchar();if(ch=='-')ob=1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();if(ob)x=-x;
}

#define lson l,mid,x<<1
#define rson mid+1,r,x<<1|1

const ll INF = 1e18;
const int N = 601000;
ll mi0[N], mi1[N], sg[N], tag[N];
int n, Q;

void build(int l, int r, int x) {
	sg[x] = mi0[x] = mi1[x] = INF;
	if(l == r) return ;
	int mid = l + r >> 1;
	build(lson), build(rson);
}

inline void down(int x) {
	const int l = x << 1, r = l | 1;
	ll&v = tag[x];
	sg[l] += v, sg[r] += v,
	mi0[l] += v, mi1[l] += v,
	mi0[r] += v, mi1[r] += v,
	tag[l] += v, tag[r] += v;
	v = 0;
}

void upd(int l, int r, int x, int ps, ll vl) {
	if(l == r) {
		if(sg[x] > vl) {
			sg[x] = vl;
			mi0[x] = vl - l;
			mi1[x] = vl + l;
		}
		return ;
	}
	if(tag[x]) down(x);
	int mid = l + r >> 1;
	if(ps <= mid) upd(lson, ps, vl);
	else upd(rson, ps, vl);
	mi0[x] = min(mi0[x<<1], mi0[x<<1|1]);
	mi1[x] = min(mi1[x<<1], mi1[x<<1|1]);
}

ll get0(int l, int r, int x, int R) {
	if(r <= R) return mi0[x];
	if(tag[x]) down(x);
	int mid = l + r >> 1;
	if(R <= mid) return get0(lson, R);
	return min(get0(lson, R), get0(rson, R));
}

ll get1(int l, int r, int x, int L) {
	if(L <= l) return mi1[x];
	if(tag[x]) down(x);
	int mid = l + r >> 1;
	if(mid < L) return get1(rson, L);
	return min(get1(lson, L), get1(rson, L));
}

ll get(int l, int r, int x) {
	if(l == r) return sg[x];
	if(tag[x]) down(x);
	int mid = l + r >> 1;
	return min(get(lson), get(rson));
}

int main() {
	read(n), read(Q);
	build(1, n, 1);
	int x, y, z;
	read(x), read(y), read(z);
	upd(1, n, 1, x, abs(y - z));
	upd(1, n, 1, y, abs(x - z));
	while(--Q) {
		read(x), y = abs(x - z);
		ll vl = min(get0(1, n, 1, x) + x, get1(1, n, 1, x) - x);
		mi0[1] += y, mi1[1] += y, tag[1] += y;
		upd(1, n, 1, z, vl), z = x;
	}
	printf("%lld\n", get(1, n, 1));
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int main(){
  int N;
  cin>>N;
  cout<<(N-2)*180<<endl;
  return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

string s;
int a[4];

int main() {
    cin >> s;
    forn(i, 4) a[i] = s[i] - '0';
    forn(mask, 16) if (!(mask & 1)) {
        int res = 0;
        forn(j, 4) if (mask & (1 << j)) {
            res -= a[j];
        } else {
            res += a[j];
        }
        if (res == 7) {
            cout << a[0];
            for (int i = 1; i < 4; ++i) if (mask & (1 << i)) {
                cout << '-' << a[i];
            } else {
                cout << '+' << a[i];
            }
            cout << "=7" << endl;
            break;
        }
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=101;
char a[N][N];
int row[N][N],col[N][N],f[N][N][N][N];
int n,m,x,y;

inline void chk(int &a,int b){a=max(a,b);}

int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%s",a[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
		{
			row[i][j]=row[i][j-1]+(a[i][j]=='o');
			col[i][j]=col[i-1][j]+(a[i][j]=='o');
			if(a[i][j]=='E') x=i,y=j;
		};
	int ans=0;
	for(int l=0;l<=y-1;++l)
		for(int r=0;r<=m-y;++r)
			for(int u=0;u<=x-1;++u)
				for(int d=0;d<=n-x;++d)
				{
					ans=max(ans,f[l][r][u][d]);
					int ub=max(x-u,1+d),db=min(x+d,n-u),lb=max(y-l,1+r),rb=min(y+r,m-l);
					int nx,ny;
					ny=y-l-1;
					if(1+r<=ny&&ny<=m-l) chk(f[l+1][r][u][d],f[l][r][u][d]+(db>=ub?(col[db][ny]-col[ub-1][ny]):0));
					ny=y+r+1;
					if(1+r<=ny&&ny<=m-l) chk(f[l][r+1][u][d],f[l][r][u][d]+(db>=ub?(col[db][ny]-col[ub-1][ny]):0));
					nx=x-u-1;
					if(1+d<=nx&&nx<=n-u) chk(f[l][r][u+1][d],f[l][r][u][d]+(rb>=lb?(row[nx][rb]-row[nx][lb-1]):0));
					nx=x+d+1;
					if(1+d<=nx&&nx<=n-u) chk(f[l][r][u][d+1],f[l][r][u][d]+(rb>=lb?(row[nx][rb]-row[nx][lb-1]):0));
				};
	printf("%d\n",ans);
 	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n, m;
int x, y;

int a[110][110];

char buf[110];
void in(){
	read(n, m);
	for(int i=1; i<=n; ++i){
		scanf("%s", buf+1);
		for(int j=1; j<=m; ++j){
			a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
			if(buf[j] == 'o'){
				++a[i][j];
			} else if(buf[j] == 'E'){
				x=i; y=j;
			}
		}
	}
}

int dp[102][102][102][102];

int rect(int L1, int R1, int D1, int U1, int L2, int R2, int D2, int U2){
	int L=max(L1, L2);
	int R=min(R1, R2);
	int D=max(D1, D2);
	int U=min(U1, U2);
	if(L>R || D>U) return 0;
	if(0) printf("%d %d %d %d\n", L, R, D, U);
	return a[R][U]-a[L-1][U]-a[R][D-1]+a[L-1][D-1];
}

int main()
{
	in();
	for(int w=1; w<=n; ++w){
		for(int h=1; h<=m; ++h){
			for(int l=1; l+w-1<=n; ++l){
				int r=l+w-1;
				if(x<l || r<x) continue;
				for(int d=1; d+h-1<=m; ++d){
					int u=d+h-1;
					if(y<d || u<y) continue;
					int me=dp[l][r][d][u];
					auto f = [&](int A, int B, int C, int D){
						int I=l+A;
						int J=r+B;
						int K=d+C;
						int L=u+D;
						int nv = rect(1+(r-x), n-(x-l), 1+(u-y), m-(y-d),
							(A||B)?(A?I:J):(I),
							(A||B)?(A?I:J):(J),
							(C||D)?(C?K:L):(K),
							(C||D)?(C?K:L):(L)
						);
						int& T=dp[I][J][K][L];
						if(T < me+nv){
							if(0) printf("upd from %d-%d, %d-%d to df %d %d %d %d : %d+%d = %d\n",
								l,r,d,u, A,B,C,D, me, nv, me+nv);
						}
						T=max(T, me+nv);
					};
					if(1 < l) f(-1, 0, 0, 0);
					if(r < n) f(0, 1, 0, 0);
					if(1 < d) f(0, 0, -1, 0);
					if(u < m) f(0, 0, 0, 1);
				}
			}
		}
	}
	printf("%d\n", dp[1][n][1][m]);
	return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
    int x,y;
    scanf("%d%d",&x,&y);
    ll ans = 0;
    if(x == 3) ans += 100000;
    else if(x == 2) ans += 200000;
    else if(x == 1) ans += 300000;
    if(y == 3) ans += 100000;
    else if(y == 2) ans += 200000;
    else if(y == 1) ans += 300000;
    if(x == 1 && y == 1) ans += 400000;
    printf("%ld\n",ans);
}

#include <iostream>
#include <string>

using namespace std;

int main() {
    int m, d, past;
    int day[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    string week[] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
    while (cin >> m >> d, m != 0) {
        past = 0;
        for (int i = 0; i < m - 1; i++) {
            past += day[i];
        }
        past += d - 1;
        cout << week[past % 7] << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    vector<vector<int>> ans(h, vector<int>(w, 0));
    rep(i, h)rep(j, w){
        if((i<b&&j<a) || (i>=b&&j>=a))ans[i][j] = 1;
    }
    rep(i, h){
        rep(j, w)cout << ans[i][j];
        cout << endl;
    }

}

#include<bits/stdc++.h>
#define int long long
#define rg register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;
const int N=200000+10;
const int mod=1e9+7;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
    return f*x;
}
int inv[N],jc[N];
int ksm(int a,int b){
	int ans=1;
	while(b){
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
int C(int n,int m){
	return jc[n]*inv[m]%mod*inv[n-m]%mod;
}
int calc(int x,int y,int X,int Y){
	int n=abs(X-x),m=abs(Y-y);
	return C(n+m,n);
}
main(){
    //file("");
	jc[0]=1;
	for(int i=1;i<=N-10;i++)
		jc[i]=jc[i-1]*i%mod;
	inv[N-10]=ksm(jc[N-10],mod-2);
	for(int i=N-11;i>=0;i--)
		inv[i]=inv[i+1]*(i+1)%mod;
	int H=read(),W=read(),A=read(),B=read(),ans=calc(1,1,H,W);
	for(int i=H-A+1;i<=H;i++)
		ans=(ans-calc(1,1,i,B)*calc(i,B+1,H,W)%mod+mod)%mod;
	cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

bool prime[1001];

void sieve(){

    memset(prime,false,sizeof(prime));
    for(int i=2;i<=1000;i++){
        if(!prime[i]){
            for(int j=i*i;j<=1000;j=j+i){
                prime[j]=true;
            }
        }
    }
}

int32_t main()
{
    sieve();
    int n;cin>>n;

    vi v(1000,0);
    for(int k=2;k<=n;k++){
        for(int i=2;i<=n;i++){
            if(!prime[i]){
                int cnt=0,val=k;
                while(val%i==0){
                    v[i]++;
                    val=val/i;
                }
                // cout<<"I inserted something"<<endl;
            }
        }
    }

    int ans=1;
    for(auto x:v){
        ans*=(x+1);
        ans%=mod;
    }
    cout<<endl;
    cout<<ans%mod<<endl;
    return 0;
}

#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		if( i % 3 == 0 || i % 10 == 3 || i / 10 % 10 == 3 || i / 100 % 10 == 3 ||  i / 1000 % 10 == 3) cout << " " << i;
	}
	cout<<endl;
	// your code goes here
	return 0;
}


#include <iostream>
#include <cmath>

#define B 600

int f(int x);

using namespace std;

int main(void) {
  int d, S = 0;
  while(cin >> d) {
    for(int i = 0; i < B/d; i++) {
      S = S + d*f(i*d);
    }
    cout << S << '\n';
    S = 0;
  }

  return 0;
}

int f(int x) {
  return pow(x,2);
}

#include <stdio.h>
int main (){
	int c;
	scanf ("%d", &c);
	int firstNumber = c / 100;
	int secondNumber = (c % 100) / 10;
	int thirdNumber = c % 10;
	if (firstNumber == 7 || secondNumber == 7 || thirdNumber == 7){
		printf ("Yes", c);
	}else{
		printf ("No", c);
	}
	return 0;
}


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

#define ll long long
#define ld long double
#define ar array

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vt<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}

string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vt<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
		if(!f)
			res+=' ';
		f=0;
		res+=to_string(x);
	}
    return res;
}

template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);
}

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

template<class T> void offset(ll o, T& x) {
	x+=o;
}
template<class T> void offset(ll o, vt<T>& x) {
	EACH(a, x)
		offset(o, a);
}
template<class T, size_t S> void offset(ll o, ar<T, S>& x) {
	EACH(a, x)
		offset(o, a);
}

mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

template<class T> T modpow(T a, T b,ll mod){
T res=1; a%=mod;
while(b){
if(b&1){ res=(res*a)%mod;}
a=(a*a)%mod;
b>>=1;
}
return res;
}
#define lcm(a,b) ((a)*(b))/(__gcd(a,b))

ll mod=1e9+7;
const int N=20;
const ld PI=2*acos(0.0);
vt<int> v(N,0);
vt<int> g(N,0);
int n;
void solve() {
ll mx=0;
read(n);
FOR(n){ int c; read(c); g[i]=(1<<i);  FOR(j,c){ int a,b; read(a,b); if(!b){v[i]|=(1<<(a-1)); } else{ g[i]|=(1<<(a-1)); } } }
FOR(i,1,1<<n){
int tmp1=0,tmp2=0;
FOR(j,n){
if(i&(1<<j))  { tmp1|=g[j]; tmp2|=v[j]; }
}
if(tmp1==i&&(!(tmp1&tmp2)))mx=max(mx,(ll)__builtin_popcount(i));
}
print(mx);
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    ll g[15][15];
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++)g[i][j]=-1;
    }
    for(ll i=0;i<n;i++){
        ll m;
        cin >> m;
        for(ll j=0;j<m;j++){
            ll a,x;
            cin >> a >> x;
            a--;
            g[i][a]=x;
        }
    }
    ll ans=0;
    for(ll i=0;i<(1<<n);i++){
        vector<ll>d(n);
        ll cnt=0;
        for(ll j=0;j<n;j++){
            if((i>>j)&1){
                d[j]=1;
                cnt++;
            }
        }
        bool judge=true;
        for(ll j=0;j<n;j++){
            if(d[j]){
                for(ll k=0;k<n;k++){
                    if(g[j][k]==-1)continue;
                    if(g[j][k]!=d[k]) judge=false;
                }
            }
        }
        if(judge){
            ans=max(ans,cnt);
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll n, k;
    cin >> n >> k;

    vector<ll> x;
    for(int i=0; i<n; i++){
        int tmpx; cin >> tmpx;
        x.push_back(tmpx);
    }

    ll ans = 1e19;
    for(int l=0; l<=n-k; l++){
        int r = l+k-1;
        ll tmp_ans = min(abs(x[l])+abs(x[l]-x[r]), abs(x[r])+abs(x[l]-x[r]));
        ans = min(ans, tmp_ans);
    }

    cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>
#define int long long
#define out(x) cerr << #x << " = " << x << "\n"
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar();bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
#define c(a, b) memset(a, b, sizeof(a))
const int N = 6e5 + 233;
int inf;
int n, Q, x, y, a[N], ans, tag, res[N];
#define root 1, n, 1
struct T {
#define ls (rt << 1)
#define rs (rt << 1 | 1)
#define mid ((l) + (((r) - (l)) >> 1))
  int tr[N << 2], tag[N << 2];
  inline void init() {
    memset(tr, 1, sizeof(tr));
    inf = tr[0] + 233;
    memset(tag, 0, sizeof(tag));
  }
  inline void pd(int rt, int l, int r) {
    if(tag[rt]) {
      tr[ls] += tag[rt];
      tr[rs] += tag[rt];
      tag[ls] += tag[rt];
      tag[rs] += tag[rt];
      tag[rt] = 0;
    }
  }

  inline void A(int L, int R, int C, int l, int r, int rt) {
    if(L <= l && r <= R) {
      tr[rt] += C;
      tag[rt] += C;
      return ;
    }pd(rt, l, r);
    if(L <= mid) A(L, R, C, l, mid, ls);
    if(R > mid) A(L, R, C, mid + 1, r, rs);
    tr[rt] = min(tr[ls], tr[rs]);
  }
  inline void in(int L, int C, int l, int r, int rt) {
    int num = q(L, L, root);
    // cout << L << " " << C << " " << num << " in\n";
    A(L, L, C - num, root);
    // cout << q(L, L, root) << "\n";
    num = q(L, L, root);
    // cout << L << " " << C << " " << num << " in\n";
    A(L, L, C - num, root);
    // cout << q(L, L, root) << "\n";
    // puts("------");
  }
  inline int q(int L, int R, int l, int r, int rt) {
    if(L <= l && r <= R) return tr[rt];
    pd(rt, l, r);
    int ans = inf;
    if(L <= mid) ans = min(ans, q(L, R, l, mid, ls));
    if(R > mid) ans = min(ans, q(L, R, mid + 1, r, rs));
    return ans;
  }
}tr1, tr2;

inline void add2(int pos, int now) {
  now += (n - (pos - 1));
  tr2.in(pos, now, root);
}

inline void add1(int pos, int now) {
  now += pos;
  tr1.in(pos, now, root);
}

inline void solve(int pos, int pre) {
  // for(int i = 1; i <= n; i ++)
  //   cout << tr2.q(i, i, root)  << " ";
  // putchar('\n');
  // for(int i = 1; i <= n; i ++)
  //   cout << tr2.q(i, 6, root) << "  a";
  // putchar('\n');

  // for(int i = 1; i <= n; i ++)
  //   if(tr1.q(i, i, root) - i < 23333)
  //     cout <<tr1.q(i, i, root) - i << " is " << i << ", ";
  // puts("");
  int l = tr2.q(1, pos, root), r = tr1.q(pos + 1, n, root);
  l -= (n - (pos - 1)); r -= pos;
  // cout  << l << " " << r << "\n";
  int now = min(l, r);
  tr1.A(1, n, abs(pos - pre), root);
  tr2.A(1, n, abs(pos - pre), root);
  add1(pre, now);
  add2(pre, now);

//   for(int i = 1; i <= n; i ++)
//     if(tr1.q(i, i, root) - i < 23333)
//       cout <<tr1.q(i, i, root) - i << " is " << i << ", ";
//   puts("");
// }
}

main() {
  read(n); read(Q); read(x); read(y);
  tr1.init(); tr2.init();
  add1(y, 0); add2(y, 0);
  a[0] = x;
  for(int i = 1; i <= Q; i ++) read(a[i]);
  for(int i = 1; i <= Q; i ++) solve(a[i], a[i - 1]);
  ans = inf;
  // for(int i = 1; i <= n; i ++)
  //   cout << tr1.q(i, i, root) - i << " ";
  for(int i = 1; i <= n; i ++) {
    res[i] = tr1.q(i, i, root) - i;
    ans = min(ans, res[i]);
  }
  cout << ans  << "\n";
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

struct S{
	int h,w,l;

	S(int h,int w):h(h),w(w){
		l=h*h+w*w;
	}

	bool operator<(const S &s)const{
		if(l==s.l) return h<s.h;
		return l<s.l;
	}
};

void Solve(){
	vector<S> rects;
	rep(i,1,151) rep(j,i+1,151) rects.push_back(S{i,j});
	sort(rects.begin(),rects.end());

	int h,w;
	while(true){
		cin >> h >> w;
		if(h==0&&w==0) break;

		auto it=++lower_bound(rects.begin(),rects.end(),S{h,w});
		cout << it->h << ' ' << it->w << endl;
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
using namespace std;
typedef pair<int,int> P;
const int INF = ~(1<<31) / 2;

int c[100][100];
int t[100][100];
int n,m,k;

int main(){
    while(1){
        scanf("%d %d",&n,&m);
        if(n==0) break;
        for(int i=0;i<m;i++){
            for(int j=0;j<m;j++){
                c[i][j] = 1000000;
                t[i][j] = 1000000;
            }
        }
        for(int i=0;i<n;i++){
            int a,b,co,ti;
            scanf("%d %d %d %d",&a,&b,&co,&ti);
            a--;b--;
            c[a][b] = co;
            c[b][a] = co;
            t[a][b] = ti;
            t[b][a] = ti;
        }

        for(int k=0;k<m;k++){
            for(int i=0;i<m;i++){
                for(int j=0;j<m;j++){
                    c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
                    t[i][j] = min(t[i][j],t[i][k]+t[k][j]);
                }
            }
        }

        scanf("%d",&k);
        for(int i=0;i<k;i++){
            int p,q,r;
            scanf("%d %d %d",&p,&q,&r);
            p--;q--;
            if(r)printf("%d\n",t[p][q]);
            else printf("%d\n",c[p][q]);
        }
    }
    return 0;
}


#include<iostream>

bool rc(int);
bool board[64]{}, row[8]{}, column[8]{}, right_down[15]{}, left_down[15]{};

int main()
{
	int k, r, c;

	std::cin >> k;
	for (int i = 0; i < k; ++i)
	{
		std::cin >> r >> c;
		board[r * 8 + c] = true;
		row[r] = column[c] = true;
		right_down[7 + c - r] = left_down[r + c] = true;
	}

	rc(k);
	for (int i = 0; i < 64; ++i)
	{
		if (board[i])
			std::cout << 'Q';
		else
			std::cout << '.';
		if (i % 8 == 7)
			std::cout << std::endl;
	}

	return 0;
}

bool rc(int k)
{
	if (k == 8)
		return true;

	for (int i = 0; i < 8; ++i)
	{
		if (row[i]) continue;
		row[i] = true;
		for (int j = 0; j < 8; ++j)
		{
			if (column[j] || right_down[7 + j - i] || left_down[i + j])
				continue;
			column[j] = right_down[7 + j - i] = left_down[i + j] = true;
			board[i * 8 + j] = true;

			if (rc(k + 1))
				return true;

			column[j] = right_down[7 + j - i] = left_down[i + j] = false;
			board[i * 8 + j] = false;
		}
		row[i] = false;
		return false;
	}
}

// ※※※ 解答不能 ※※※
// Um_nik氏
// https://atcoder.jp/contests/agc041/submissions/9181788
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int N = 1010;
int n;
char s[N][N];
char a[4][5] = {
    "aabc",
    "ddbc",
    "efgg",
    "efhh"
};
char b[5][6] = {
    "aabbc",
    "dee.c",
    "d..fg",
    "h..fg",
    "hiijj"
};
char c[7][8] = {
    "aabbc..",
    "d...cee",
    "dffgg..",
    "hh...ij",
    "..k..ij",
    "..k..lm",
    "...nnlm"
};

void solve(vector<int> w){
    int p = 0;
    for(int x : w){
        if(x == 4)      rep(i, x) rep(j, x) s[p + i][p + j] = a[i][j];
        else if(x == 5) rep(i, x) rep(j, x) s[p + i][p + j] = b[i][j];
        else if(x == 7) rep(i, x) rep(j, x) s[p + i][p + j] = c[i][j];
        p += x;
    }
}

int main(){
    scanf("%d", &n);
    if(n == 2){
        printf("-1\n");
        return 0;
    }
    rep(i, n) rep(j, n) s[i][j] = '.';
    if(n % 3 == 0){
        repex(i, 0, n, 3) s[i][i] = s[i][i + 1] = s[i + 1][i + 2] = s[i + 2][i + 2] = 'a';
    }else{
        if(n == 7){
            solve({7});
        }else if (n == 11){
            solve({4, 7});
        }else{
            vector<int> w;
            int x = n;
            while(x % 4 != 0){
                w.push_back(5);
                x -= 5;
            }
            if(x < 0) throw;
            while(x > 0){
                w.push_back(4);
                x -= 4;
            }
            solve(w);
        }
    }
    rep(i, n){
        s[i][n] = '\0';
        printf("%s\n", s[i]);
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

namespace program
{
	namespace IO
	{
		struct input_t
		{
			static const int BUF_SIZ = 500000;
			FILE *f;
			char Buf[BUF_SIZ], *p, *pend;
			input_t(FILE *_f) : f(_f), p(Buf), pend(Buf) {}
			~input_t() { fclose(f); }
			char getchar();
			template <typename T>
			T read();
		};

		char input_t::getchar()
		{
			if (p >= pend)
			{
				p = Buf;
				pend = Buf + fread(Buf, sizeof(char), BUF_SIZ, f);
				if (p >= pend)
					return EOF;
			}
			return *p++;
		}

		template <typename T>
		T input_t::read()
		{
			T s = 0;
			int fl = 0;
			char ch;
			while (!isdigit(ch = getchar()))
				fl ^= (ch == '-');
			do
				s = s * 10 + ch - '0';
			while (isdigit(ch = getchar()));
			return fl ? -s : s;
		}

		struct output_t
		{
			static const int BUF_SIZ = 500000;
			FILE *f;
			char Buf[BUF_SIZ], *p, *const pend;
			output_t(FILE *_f) : f(_f), p(Buf), pend(Buf + BUF_SIZ) {}
			~output_t()
			{
				fwrite(Buf, sizeof(char), p - Buf, f);
				fclose(f);
			}
			void putchar(char ch);
			template <typename T>
			void write(T x);
			void puts(const char *ch);
		};

		void output_t::putchar(char ch)
		{
			*p++ = ch;
			if (p >= pend)
			{
				fwrite(Buf, sizeof(char), p - Buf, f);
				p = Buf;
			}
		}

		template <typename T>
		void output_t::write(T x)
		{
			static char St[30];
			char *top = St;
			if (x < 0)
			{
				putchar('-');
				x = -x;
			}
			do
				*top++ = x % 10 + '0';
			while (x /= 10);
			while (top > St)
				putchar(*--top);
		}

		void output_t::puts(const char *ch)
		{
			while (*ch)
				putchar(*ch++);
			putchar('\n');
		}
	}

	IO::input_t input(stdin);
	IO::output_t output(stdout);

	typedef long long big;

	const int MAXN = 100000;

	template <typename T>
	vector<T> &operator*=(vector<T> &A, vector<int> B)
	{
		vector<T> C = A;
		for (int i = 0; i < A.size(); i++)
			A[i] = C[B[i]];
		return A;
	}

	template <typename T1, typename T2>
	void qpow(T1 &S, T2 X, big n)
	{
		while (n)
		{
			if (n & 1)
				S *= X;
			X *= X;
			n >>= 1;
		}
	}

	void work()
	{
		int n = input.read<int>(), m;
		big k;
		vector<big> X;
		vector<int> C;
		for (int i = 0; i < n; i++)
		{
			X.push_back(input.read<big>());
			C.push_back(i);
		}
		for (int i = n - 1; i > 0; i--)
			X[i] -= X[i - 1];
		m = input.read<int>();
		k = input.read<big>();
		while (m--)
		{
			int x = input.read<int>();
			swap(C[x - 1], C[x]);
		}
		qpow(X, C, k);
		for (int i = 1; i < n; i++)
			X[i] += X[i - 1];
		for (int i = 0; i < n; i++)
		{
			output.write(X[i]);
			output.puts(".0");
		}
	}
}

int main()
{
	program::work();
	return 0;
}


#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){
  int a,b,c; cin >> a >> b >> c;
  cout << min(a+b,min(b+c,a+c)) << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    ll X = tx-sx;
    ll Y = ty-sy;

    REP(i, X){
        cout << 'R';
    }
    REP(i, Y+1){
        cout << 'U';
    }
    REP(i, X+1){
        cout << 'L';
    }
    REP(i, Y+1){
        cout << 'D';
    }

    cout << "RD";

    REP(i, X+1){
        cout << 'R';
    }
    REP(i, Y+1){
        cout << 'U';
    }
    REP(i, X+1){
        cout << 'L';
    }
    REP(i, Y){
        cout << 'D';
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>

#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

using namespace std;

static const double EPS = 1e-9;
typedef pair<int, int> pii;
typedef long long ll;

double l[11]={0}, v1, v2;

int solve(){

	double r = v1/(v1+v2);
	double x = r*l[10];

	for(int i=1; i <= 10; ++i){
		if( x <= l[i] )
			return i;
	}

	return 10;
}

int main(){

	char c;

	while(cin>>l[1]>>c>>l[2]>>c>>l[3]>>c>>l[4]>>c>>l[5]>>c>>
			l[6]>>c>>l[7]>>c>>l[8]>>c>>l[9]>>c>>l[10]>>c>>v1>>c>>v2, !cin.eof()){

		for(int i=1; i<=10; ++i){

			l[i]+=l[i-1];
		}

		cout << solve() << endl;
	}

	return 0;
}

#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        long ans=0;
        //printf("%d\n",n);
        for(int i=0;i<600;i+=n){
            ans+=i*i*n;
        }

        printf("%ld\n",ans);
    }
    return 0;
}


/*
verified on 2019/12/13
vec2d<double> -> https://atcoder.jp/contests/agc021/submissions/8932641
vec2d<long>   -> https://atcoder.jp/contests/abc022/submissions/8932886
*/

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

using namespace std;

/* ここからスニペット */
#include <complex>
#include <numeric>
#include <iomanip>

namespace geometry2d {
    using value_t = double;
    using point_t = complex<double>;

    // 内積, 外積
    inline value_t dot(point_t a, point_t b)   { return a.real() * b.real() + a.imag() * b.imag(); }
    inline value_t cross(point_t a, point_t b) { return a.real() * b.imag() - a.imag() * b.real(); }

    // 単位ベクトル, なす角のcos
    inline point_t unit(point_t p) { return p / abs(p); }
    inline value_t cos_between(point_t a, point_t b) { return dot(unit(a), unit(b)); }

    // 辞書順演算子
    inline bool operator<(const point_t l, const point_t r) {
        return (l.real() != r.real() ? l.real() < r.real() : l.imag() < r.imag());
    }
    inline bool operator>(const point_t l, const point_t r) {
        return (l.real() != r.real() ? l.real() > r.real() : l.imag() > r.imag());
    }
    inline bool operator<=(const point_t l, const point_t r) { return !(l > r); }
    inline bool operator>=(const point_t l, const point_t r) { return !(l < r); }

    // 点集合pointsに対して凸包を作る
    // ansに凸包の各点(pointsでのインデックス)が入る
    // 戻り値はansのサイズ
    int convex_hull(vector<point_t> &points, vector<int> &ans) {
        int n = (int)points.size();
        size_t k = 0;
        vector<size_t> lid((size_t)n), _ans((size_t)n * 2);

        // pointsを辞書順ソートしたときのインデックスの順列を作る
        iota(lid.begin(), lid.end(), 0);
        sort(lid.begin(), lid.end(), [&points](size_t l, size_t r) {
            return points[l] < points[r];
        });

        // 下側
        for (int i=0; i<n; i++) {
            while (k > 1 && cross(points[_ans[k-1]] - points[_ans[k-2]], points[lid[(size_t)i]] - points[_ans[k-1]]) <= 0)
                k--;
            _ans[k] = lid[(size_t)i];
            k++;
        }

        // 上側
        for (int i=n-2, s=(int)k; i>=0; i--) {
            while ((int)k > s && cross(points[_ans[k-1]] - points[_ans[k-2]], points[lid[(size_t)i]] - points[_ans[k-1]]) <= 0)
                k--;
            _ans[k] = lid[(size_t)i];
            k++;
        }

        for (size_t i=0; i<k-1; i++) ans.push_back((int)_ans[i]);

        return (int)k-1;
    }
} // namespace geometry2d

namespace std {
    istream &operator>>(istream &is, geometry2d::point_t &p) {
        geometry2d::value_t a, b;
        is >> a >> b;
        p = geometry2d::point_t(a, b);
        return is;
    }
    ostream &operator<<(ostream &os, geometry2d::point_t &p) {
        return os << fixed << setprecision(10) << p.real() << ' ' << p.imag();
    }
}

int main(){
    int n;
    cin >> n;
    vector<geometry2d::point_t> points(n);
    for (auto &pi:points) cin >> pi;
    vector<int> ch;
    int m = geometry2d::convex_hull(points, ch);
    double ans[n];
    fill(ans, ans+n, 0);
    geometry2d::point_t prev = points[ch[m-1]];
    for (int i=0; i<m; i++) {
        geometry2d::point_t cur  = points[ch[i]];
        geometry2d::point_t next = points[ch[(i+1)%m]];
        ans[ch[i]] = acos(geometry2d::cos_between(cur - prev, next - cur)) / (2 * M_PI);
        prev = cur;
    }
    for (auto &ai:ans) cout << fixed << setprecision(15) << ai << '\n';
    return 0;
}

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

int InsertionSort(vector<int> &A, int g){
    int N = A.size();
    int cnt = 0;

    for(int i = g; i < N; ++i){
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j + g] = A[j];
            j = j - g;
            ++cnt;
        }
        A[j + g] = v;
    }

    return cnt;
}

int main(void){
    int cnt = 0;
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for(int i = 0; i < N; ++i)
        cin >> A[i];

    vector<int> G;
    int g = 1;
    while(g <= N){
        G.push_back(g);
        g = 3 * g + 1;
    }
    int m = G.size();
    cout << m << endl;
    for(int i = m - 1; i >= 0; --i){
        cout << G[i];
        if(i != 0)
            cout << " ";
    }
    cout << endl;

    for(int i = m - 1; i >= 0; --i){
        cnt += InsertionSort(A, G[i]);
    }
    cout << cnt << endl;

    for(int i = 0; i < N; ++i){
        cout << A[i];
        if(i != N - 1)
            cout << endl;
    }

    return 0;
}


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

int w,h;
int sx,sy,gx,gy;
int field[104][104];

class Info{
public:
	int x,y;
};

bool bfd(void){
	int search = field[sy-1][sx-1];
	int dx[4] = {1,-1,0,0};
	int dy[4] = {0,0,1,-1};

	queue<Info> q;
	Info tmp = {sx-1,sy-1};

	if(search == 0){return false;}

	q.push(tmp);
	while(!q.empty()){
		tmp = q.front(); q.pop();

		if(tmp.x + 1 == gx && tmp.y + 1 == gy){
			return true;
		}

		field[tmp.y][tmp.x] = 0;
		for(int k=0;k<4;k++){
			int nx = tmp.x + dx[k];
			int ny = tmp.y + dy[k];

			if(nx>=0 && ny>=0 && nx<w && ny<h && field[ny][nx]==search){
				Info tmp2 = {nx,ny};
				q.push(tmp2);
			}
		}
	}

	return false;
}

void put_block(int c,int d,int x,int y){
	int i,j;
	int to_i=2,to_j=4;

	if(d == 1){to_i=4,to_j=2;}

	for(i=0;i<to_i;i++){
		for(j=0;j<to_j;j++){
			field[y+i-1][x+j-1] = c;
		}
	}
}

int main(void){
	int n,c,d,x,y;

	while(cin>>w>>h && w){
		cin>>sx>>sy>>gx>>gy>>n;

		memset(field,0,sizeof(field));
		while(n--){
			cin>>c>>d>>x>>y;
			put_block(c,d,x,y);
		}

		if(bfd()){
			cout<<"OK\n";
		}
		else{
			cout<<"NG\n";
		}
	}

	return 0;
}

#include <iostream>
#include <limits.h>

using namespace std;

int m;

int dijkstra( const int data[101][101], int start, int end )
{
	int i,j,next,min;
	bool visited[101];
	int distance[101];

	for( i = 1;i <= 100;i++ ){
		visited[i] = false;
		distance[i] = INT_MAX;
	}

	distance[start] = 0; next = start;

	do{
		i = next; visited[i] = true; min = INT_MAX;
		for(j = 1;j <= m;j++){
			if(visited[j]) continue;
			if(data[i][j] < INT_MAX && distance[i] + data[i][j] < distance[j]) {
				distance[j] = distance[i] + data[i][j];
			}
			if( distance[j] < min ){
				min = distance[j]; next = j;
			}
		}
	} while( min < INT_MAX );

	return distance[end];
}

int main(int argc, char const* argv[])
{
	int n,weight[101][101][2];

	while( cin >> n >> m && n != 0 && m != 0 ){
		int a,b,c,d;
		for( int i = 0;i < 101;i++ ){
			for( int j = 0;j < 101;j++ ){
				weight[i][j][0] = INT_MAX;
				weight[i][j][1] = INT_MAX;
			}
		}

		for( int i = 0;i < n;i++ ){
			cin >> a >> b >> c >> d;
			weight[a][b][0] = c;
			weight[b][a][0] = c;
			weight[a][b][1] = d;
			weight[b][a][1] = d;
		}

		cin >> n;

		for( int i = 0;i < n;i++ ){
			int data[101][101];
			int p,q,r;
			cin >> p >> q >> r;
			for( int j = 1;j < 101;j++ ){
				for( int k = 1;k <101;k++ ) data[j][k] = weight[j][k][r];
			}
			cout << dijkstra( data, p, q ) << endl;
		}
	}

	return 0;

}


#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

typedef pair<double, string> P;
typedef pair<string, double> Q;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		string plant;
		int p, a, b, c, d, e, f, s, m;
		int time;
		double kou;
		priority_queue<P> pq;
		for (int i = 0; i < n; i++) {
			cin >> plant >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			time = a+b+c+(d+e)*m;
			kou = (double)(s*f*m-p) / (double)time;
			P pp;
			pp.first = kou;
			pp.second = plant;
			pq.push(pp);
		}
		while (!pq.empty()) {
			P ppp = pq.top();
			pq.pop();
			priority_queue< Q, vector<Q>, greater<Q> > pqq;
			Q q;
			q.first = ppp.second;
			q.second = ppp.first;
			pqq.push(q);
			while (!pq.empty()) {
				if ((pq.top()).first == ppp.first) {
					q.first = (pq.top()).second;
					pqq.push(q);
					pq.pop();
				} else {
					break;
				}
			}
			while (!pqq.empty()) {
				cout << (pqq.top()).first << endl;
				pqq.pop();
			}
		}
		cout << '#' << endl;
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

struct Plant {
  string l;
  int p, a, b, c, d, e, f, s, m;

  Plant(string l, int p, int a, int b, int c, int d, int e, int f, int s, int m) {
    this->l = l;
    this->p = p;
    this->a = a;
    this->b = b;
    this->c = c;
    this->d = d;
    this->e = e;
    this->f = f;
    this->s = s;
    this->m = m;
  }

  int time() {
    return a + b + c + d + e + (m-1) * (d + e);
  }

  int benefit() {
    return f * s * m - p;
  }
};

static bool operator< (Plant &p1, Plant &p2) {
  if(p1.benefit() * p2.time() == p2.benefit() * p1.time()) {
    return p1.l < p2.l;
  } else {
    return p1.benefit() * p2.time() > p2.benefit() * p1.time();
  }
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    vector<Plant> plants;
    REP(i, n) {
      string l; cin >> l;
      int p, a, b, c, d, e, f, s, m; cin >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      plants.pb(Plant(l, p, a, b, c, d, e, f, s, m));
    }
    sort(ALL(plants));
    REP(i, n) {
      cout << plants[i].l << endl;
    }
    cout << "#" << endl;
  }
}


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

long total[4005];

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

	int n, id, p, q, cnt;
	cin >> n;
	while (n != 0) {
		for (int i = 0; i < 4005; i++) {
			total[i] = 0;
		}
		cnt = 1;
		for (int i = 0; i < n; i++) {
			cin >> id >> p >> q;
			long before = total[id];
			total[id] += p * q;
			if (before < GOOD && total[id] >= GOOD) {
				cout << id << endl;
				cnt = 0;
			}
		}
		if  (cnt) {
			cout << "NA" << endl;
		}
		cin >> n;
	}
}

#include <iostream>
using namespace std;

int main(){
    int n, x, y, m, d;
    char l;
    int field[21][21];
    int rx, ry;
    cin >> n;
    while(n){
        for(int i=0;i<21;++i){
            for(int j=0;j<21;++j){
                field[i][j] = 0;
            }
        }
        rx = 10, ry = 10;
        for(int i=0;i<n;++i){
            cin >> x >> y;
            field[x][y] = 1;
        }
        cin >> m;
        for(int i=0;i<m;++i){
            cin >> l >> d;
            for(int j=0;j<d;++j){
                switch(l){
                    case 'N':
                        ++ry;
                        break;
                    case 'S':
                        --ry;
                        break;
                    case 'E':
                        ++rx;
                        break;
                    case 'W':
                        --rx;
                        break;
                }
                if(field[rx][ry] == 1){
                    field[rx][ry] = 0;
                    --n;
                }
            }
        }
        if(n) cout << "No" << endl;
        else cout << "Yes" << endl;
        cin >> n;
    }
}


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

int M = 1000000007;

int mod(int a){
	return (a%M + M)%M;
}
int mul(int a, int b){
	return mod(mod(a) * mod(b));
}
int add(int a, int b){
	return mod(mod(a) + mod(b));
}
int sub(int a, int b){
	return mod(mod(a) - mod(b));
}
main(){
	int n; cin>>n;
	int a[n];
	for(auto &it : a) cin>>it;

	int sum=0, sum1=0;
	for(int i=0; i<n; i++){
		sum = add(sum,a[i]);
		//sum1 = add(sum1,mul(a[i],a[i]));
	}
	int ans=0;
    for(int i=0; i<n; i++){
		sum = sub(sum,a[i]);
		ans = add(ans,mul(sum,a[i]));
	}
	cout<<ans;
}

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  long long all = 0;
  long long p = 1000000007;
  for(int i = 0; i < n; i++){
    all += a[i];
    all = all % p;
  }
  long long ans = 0;
  for(int i = 0; i < n; i++){
    all -= a[i];
    if(all < 0) all += p;
    ans += a[i] * all;
    ans %= p;
  }
  cout << ans << endl;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
const int INF = 1<<28;

int main() {
	int n, q;
	while(cin >> n >> q, n|q) {
		int days[100] = {};
		for(int i=0; i<n; i++) {
			int num;
			cin >> num;
			for(int j=0; j<num; j++) {
				int temp;
				cin >> temp;
				days[temp]++;
			}
		}
		int  ans = 0;
		for(int i=0; i<100; i++)
			if(days[i] >= q && days[i] > days[ans])
				ans = i;
		cout << ans << endl;
	}

	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int n,sum = 0,ans,sumkeep;

  while(cin >> n){
    if(n == 0)break;

    ans = 0;
    sumkeep = 0;

    int a[n];

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

    for(int i = 0;i < n;i++){
      sumkeep = 0;
      for(int j = i;j < n;j++){
	sumkeep += a[j];
	if(i == 0 && j == 0){
	  ans = sumkeep;
	}
	else if(ans < sumkeep){
	  ans = sumkeep;
	}
      }
    }
    cout << ans << endl;
  }
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

int main(){
  int n;
  cin >> n;
  string ans;
  if(n<1200) ans = "ABC";
  else if(n<2800) ans = "ARC";
  else ans = "AGC";
  cout << ans << endl;
  return 0;
}

#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <numeric>    // accumulate
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll N, fX = 0;
  string s;
  cin >> N;
  s = to_string(N);
  for (auto c : s) {
    fX += c - '0';
  }

  cout << (N % fX == 0 ? "Yes" : "No") << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

template<class V, int ME> class BIT {
public:
    V bit[1<<ME];
    V total(int e) {V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
    void update(int e, V val) {e++; while(e<=1<<ME) bit[e-1]+=val,e+=e&-e;}
};

int main(){
    int N, tmp;
    cin >> N;
    vector<int> inputs(N), rank(N);
    vector<pii> x(N);
    REP(i, N){
        cin >> x[i].first;
        x[i].second = i;
    }
    sort(x.begin(), x.end());
    REP(i, N){
        rank[x[i].second] = i+1;
    }

    REP(i, N){
        inputs[--rank[i]] = i;
    }

    BIT<int, 19> bit;
    ll res = 0;
    REP(i, N){
        bit.update(inputs[i], 1);
        //cout << bit.total(N) - bit.total(inputs[i]) << endl;
        res += (bit.total(N) - bit.total(inputs[i]));
    }
    cout << res << endl;
    return 0;
}

#include <climits>
#include <iostream>
#include <vector>

typedef std::vector<int> IntVector;

void Input(IntVector& Inputs)
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	long long Count;
	std::cin >> Count;
	Inputs.resize(Count);
	for(long long i=0;i<Count;i++){
		int N = 0;
		std::cin >> N;
		Inputs[i] = N;
	}
}

void Output(IntVector& Outputs)
{
	for(long long i=0;i<Outputs.size();i++){
		std::cout << Outputs[i];
		if(i + 1 < Outputs.size()){
			std::cout << " ";
		}else{
			std::cout << std::endl;
		}
	}
}

long long merge(IntVector& A,int left,int mid,int right)
{
	long long n1 = mid - left;
	long long n2 = right - mid;

	IntVector L(n1+1);
	for(long long i=0;i<n1;i++){
			L[i] = A[left+i];
	}
	IntVector R(n2+1);
	for(long long i=0;i<n2;i++){
		R[i] = A[mid+i];
	}
	L[n1] = INT_MAX;
	R[n2] = INT_MAX;

	long long i = 0;
	long long j = 0;
	long long Count = 0;
	for(int k=left;k<right;k++){
		if(L[i] <= R[j]){
			A[k] = L[i];
			i++;
			Count += j;
		}else{
			A[k] = R[j];
			j++;
		}
	}
	return Count;
}

long long mergeSort(IntVector& A,int left,int right)
{
	if(left+1 >= right) return 0;
	long long mid = (left + right)/2;
	long long Count = 0;
	Count += mergeSort(A,left,mid);
	Count += mergeSort(A,mid,right);
	return Count + merge(A,left,mid,right);
}

int main()
{
	IntVector Inputs;
	Input(Inputs);
	long long CrossCount = mergeSort(Inputs,0,Inputs.size());
	std::cout << CrossCount << std::endl;
	return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */
int main(){
    int n; cin >> n;
    string s; cin >> s;
    int o[] = {0, 3, 1, 2};
    int x[] = {1, 2, 0, 3};
    string sr[] = {"SS", "SW", "WS", "WW"};
    rep(t, 4){
        int u = t; vector<int> v;
        rep(i, n){
            v.push_back(u);
            if(s[i] == 'o') u = o[u];
            else u = x[u];
        }
        if(u != t) continue;
        string ans = "";
        rep(i, n){
            if(v[i] % 2) ans += "W";
            else ans += "S";
        }
        out(ans); return 0;
    }
    out(-1);
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long A, long long B)
{
  cout << A * B << endl;
}

int main()
{
  cout << setprecision(10);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


#include <cstdio>
#include <set>

int main()
{
  int s, t; //number of integers for S and T

  int count = 0; // number of integers of T in S

  std::set<int> S; // set S to be checked against

  scanf("%d", &s);

  for (int i = 0; i < s; ++i) {
    int input;
    scanf("%d", &input);
    S.insert(input);
  }

  scanf("%d", &t);

  for (int i = 0; i < t; ++i) {
    int input;
    scanf("%d", &input);
    if ( S.find(input) != S.end() ) ++count; // increment count if found in S
  }

  printf("%d\n", count);
}

#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<algorithm>
#include<functional>
using namespace std;

int n,q;
int a=0;
int c=0;
int s[10000]={};
int t[10000]={};

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
	cin>>s[i];
	}

	cin>>q;
	for(int j=0;j<q;j++)
	{
	cin>>t[j];
	}

	for(int k=0;k<n;k++)
	{
	for(int l=0;l<q;l++)
	{
	a=s[k]^t[l];
	if(a==0)
	{
	c+=1;
	t[l]=-1;
	}
	}

	}
	cout<<c<<endl;
	return 0;
}


#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b; b = c % b;
	}
	return a;
}
inline ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
bool isprime(ll n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
ll mypow(ll a, ll b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int n, m, a[110];
signed main() {
	cin >> n >> m;
	int oddcount = 0;
	rep(i, m) {
		cin >> a[i];
		if (a[i] & 1)oddcount++;
	}
	if (m == 1) {
		if (a[0] == 1) {
			cout << 1 << endl << 1 << endl << 1 << endl;
			return 0;
		}
		cout << a[0] << endl;
		cout << 2 << endl;
		cout << a[0] - 1 << " " << 1 << endl;
		return 0;
	}
	if (oddcount >= 3) {
		puts("Impossible");
		return 0;
	}
	if (oddcount == 2 && (n & 1)) {
		puts("Impossible");
		return 0;
	}
	REP(i, m - 1) {
		if (a[i] & 1) {
			if (a[0] & 1) {
				swap(a[i], a[m - 1]);
				break;
			}
			swap(a[0], a[i]);
		}
	}
	mt19937_64 mt;
	if (oddcount == 0)shuffle(a, a + m, mt);
	if (oddcount == 1)shuffle(a + 1, a + m, mt);
	if (oddcount == 2 && m >= 3)shuffle(a + 1, a + m - 1, mt);
	vector<int> b;
	rep(i, m - 1) {
		if (i == 0) {
			b.push_back(a[i] + a[i + 1] - 1);
		}
		else b.push_back(a[i + 1]);
	}
	rep(i, m - 1)cout << a[i] << " ";
	cout << a[m - 1] << endl;
	cout << b.size() << endl;
	rep(i, b.size() - 1)cout << b[i] << " ";
	cout << b.back() + 1 << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = 998244353;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}

const int N = (int)1e6 + 77;
ll f[N], rf[N];

ll getC(int n, int k) {
	if (k < 0 || k > n) return 0;
	return mult(f[n], mult(rf[k], rf[n - k]));
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	f[0] = 1;
	for (int i = 1; i < N; i++)
		f[i] = mult(f[i - 1], i);
	rf[N - 1] = rev(f[N - 1]);
	for (int i = N - 1; i > 0; i--)
		rf[i - 1] = mult(rf[i], i);

	int n, m;
	scanf("%d%d", &n, &m);
	ll ans = 0;
	for (int k = 1; k <= min(n, m); k++)
		ans = add(ans, mult(getC(2 * k, k), getC(n + m - 2 * k, n - k)));
	ans = mult(ans, rev(mult(2, getC(n + m, m))));
	ans = add(ans, max(n, m));
	printf("%lld\n", ans);

	return 0;
}

#include<bits/stdc++.h>
#define mod 998244353
#define maxn 1000005
using namespace std;
typedef long long LL;
int read()
{
    char c=getchar();int f=1,sum=0;
    while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
    return sum*f;
}
int n,m;
LL fac[maxn],inv[maxn],ans;
LL ksm(LL a,LL b){LL ret=1;while(b){if(b&1) ret=ret*a%mod;a=a*a%mod;b>>=1;}return ret;}
void init(int x)
{
	fac[0]=1;
	for(int i=1;i<=x;i++) fac[i]=fac[i-1]*i%mod;
	inv[x]=ksm(fac[x],mod-2);
	for(int i=x;i>=1;i--) inv[i-1]=inv[i]*i%mod;
}
LL calc(LL x,LL y){return fac[x+y]*inv[x]%mod*inv[y]%mod;}
int main()
{
	n=read();m=read();
	if(n>m) swap(n,m);
	init(n+m);
	for(int i=1;i<=n;i++) ans+=calc(i,i)*calc(n-i,m-i)%mod;
    ans=ans%mod*ksm(calc(n,m)<<1,mod-2)%mod;
    printf("%lld\n",(ans+m)%mod);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    int cards[5];
    char dummy;
    while (cin>>cards[0]>>dummy>>cards[1]>>dummy>>cards[2]>>dummy>>cards[3]>>dummy>>cards[4])
    {
        int count=0,ans=0;
        sort(cards,cards+5);
        for (int i=0; i<4; i++)
        {
            if ( cards[i] == cards[i+1] )
            {
                count++;
                ans+=count;
            }
            else count=0;
        }

        if (ans==0)
        {
            int sum=0;
            for (int i=0; i<5; i++) sum+=cards[i];
            if(sum-cards[0]*5==10) puts("straight");
            else if(cards[0]==1 && cards[1]==10 && cards[2]==11 && cards[3]==12 && cards[4]==13) puts("straight");
            else puts("null");
        }

        else if (ans==1) puts("one pair");
        else if (ans==2) puts("two pair");
        else if (ans==3) puts("three card");
        else if (ans==4) puts("full house");
        else if (ans==6) puts("four card");

    }
    return 0;
}

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

void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
    int size = sizeof...(Tail);
    cout << head;
    if (size > 0) {
        cout << " ";
    }
    print(tail...);
}

void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
    cout << head;
    print0(tail...);
}

struct xstruct {
    ll val;
};
bool operator<=(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val <= rhs.val;
}
bool operator<(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val < rhs.val;
}
bool operator>=(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val >= rhs.val;
}
bool operator>(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val > rhs.val;
}
bool operator==(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val == rhs.val;
}
bool operator!=(const xstruct& lhs, const xstruct& rhs) {
    return lhs.val != rhs.val;
}
ostream& operator<<(ostream& os, xstruct const& xst) {
    return os << xst.val;
}

int main() {
    string sa, sb;
    getline(cin, sa);
    getline(cin, sb);

    ll la = sa.length();
    ll lb = sb.length();

    // edit_distance
    vector<vector<ll>> edit_distance(la + 1, vector<ll>(lb + 1));
    for (ll a = 0; a <= la; a++) {
        for (ll b = 0; b <= lb; b++) {
            edit_distance[a][b] = -1;
        }
    }
    for (ll a = 0; a <= la; a++) {
        edit_distance[a][0] = a;
    }
    for (ll b = 0; b <= lb; b++) {
        edit_distance[0][b] = b;
    }
    for (ll a = 1; a <= la; a++) {
        for (ll b = 1; b <= lb; b++) {
            ll minval = la + lb;
            if (sa.at(a - 1) == sb.at(b - 1)) {
                minval = min(minval, edit_distance[a - 1][b - 1]);  // same
            }
            minval = min(minval, 1 + edit_distance[a - 1][b - 1]);  // replace
            minval = min(minval, 1 + edit_distance[a - 1][b]);      // insert
            minval = min(minval, 1 + edit_distance[a][b - 1]);      // delete
            edit_distance[a][b] = minval;
        }
    }

    print(edit_distance[la][lb]);
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n,d,ans;
string s;
int p[110];
void func(int i,int D,int ret){
    if(i==(n+1)/2-1){
        if(D==0){
            if(n%2)ret*=10;
            ans+=ret;
        }
        return;
    }
    {
        //+
        int m=(D+INF)%10;
        int cnt=10-m;
        if(i==n-1)cnt--;
        func(i-1,(D-p[i]*m)/10,ret*cnt);
    }
    {
        //-
        if((D+INF)%10==0)return;
        int m=10-(D+INF)%10;
        int cnt=10-m;
        //if(i==n-1)cnt--;
        func(i-1,(D+p[i]*m)/10,ret*cnt);
    }
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>d;
    if(d%9){
        puts("0");
        return 0;
    }
    d/=9;
    for(n=2;n<=18;n++){
        fill(p,p+17,0);
        p[(n+1)/2]=(n%2?11:1);
        for(int i=(n+1)/2+1;i<n;i++)p[i]=(p[i-1]*10+1)*10+1;
        func(n-1,d,1);
        //cout<<d<<" "<<ans<<endl;
        /*if(n==5){
            cout<<p[n-3]<<" "<<p[n-2]<<" "<<p[n-1]<<endl;
        }*/
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

bool isprime(ll n){
  if (n == 0 || n == 1)
    return false;

  for (ll i = 2; i*i <= n; i++){
    if (n % i == 0)
      return false;
  }

  return true;
}

int main(void){
  ll n;
  cin >> n;

  ll ans = 1;
  for (ll i = 0; i <= n; i++){
    if (isprime(i)){
      ll t = 1;
      ll j = i;
      while (j <= n){
        t += n / j;
        j *= i;
      }

      ans = ans * t % MOD;
    }
  }
  cout << ans << endl;

  return 0;
}

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

const int mod = 1e9 + 7;

map < int, int > primes (int x) {
  map < int, int > res;
  for (int i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      ++res[i];
    }
  }
  if (x != 1)
    ++res[x];
  return res;
}

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

  int n;
  cin >> n;
  map < int, int > pows;
  for (int i = 2; i <= n; ++i) {
    map < int, int > here = primes(i);
    for (auto pr: here)
      pows[pr.first] += pr.second;
  }
  int64_t ans = 1;
  for (auto pr: pows)
    (ans *= (pr.second + 1)) %= mod;
  cout << ans << '\n';
}


#include<bits/stdc++.h>
#define GPA 4
#define ROLLMAN endl

using namespace std;
typedef int OTAKU;

OTAKU main(){

  OTAKU roll[ GPA ], man[ GPA ];

  for(OTAKU i = 0; i < 4; i++)cin>>roll[i];
  for(OTAKU i = 0; i < 2; i++)cin>>man[i];

  sort(roll,roll+4);
  sort(man,man+2);

  OTAKU Happy_Birthday=0;

  for(OTAKU i = 3; i > 0; i--) Happy_Birthday += roll[i];
  Happy_Birthday += man[1];

  cout << Happy_Birthday << ROLLMAN;
  return GPA-4;
}

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

int N;
int main() {
    cin >> N;
    vector<int> v;
    for (int i =0 ;i < 2 * N; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i =0 ;i < N; i++) {
        ans += v[2 * i];
    }
    cout << ans << '\n';
}


//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

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

const ll INF = 1000000010;
const ll LOG = 25;
const int N = 2000 + 10;
int MOD;

int mul(int a, int b){
	return (a * 1ll * b) % MOD;
}

int add(int a, int b){
	a += b;
	a %= MOD;
	return a;
}

int dp[3 * N][3 * N], n;

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> MOD;
	dp[0][0] = 1;
	for (int i = 1; i <= 3 * n; i++){
		for (int j = 0; j <= i / 2; j++){
			dp[i][j] = add(dp[i][j], dp[i - 1][j]);
			if (j != 0){
				if (i > 1) dp[i][j] = add(dp[i][j], mul(i - 1, dp[i - 2][j - 1]));
				if (i > 2) dp[i][j] = add(dp[i][j], mul(i - 2, mul(i - 1, dp[i - 3][j - 1])));
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++){
		ans = add(ans, dp[3 * n][i]);
	}
	cout << ans;

	return 0;
}

#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;//998'244'353;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

template<typename T>
T power(T x, long long n, const T &m){
    if(n == 0) return 1;
    if(n == 1) return x;
    T tmp = power(x, n/2, m);
    if(n%2 == 0) return tmp * tmp % m;
    else return tmp * tmp % m * x % m;
}

template<typename T>
T inverse(T x, const T &m){
    return power(x, m-2, m);
}

struct Combination{
    int N;
    long long M;
    vector<long long> f, i;
    void init(int n, long long m){
        N = n; M = m;
        f.resize(N+1); f[0] = 1;
        i.resize(N+1); i[0] = 1;
        for(long long j=1; j<=N; j++){
            f[j] = f[j-1]*j%M;
            i[j] = inverse(f[j], M);
        }
    }
    long long fact(int n){
        return f[n];
    }
    long long C(int n, int r){
        return f[n] * i[r] % M * i[n-r] % M;
    }
};

int N;
ll M;

Combination comb;

ll solve(int N){
    ll ans = 0;
    ll tmp = 1;
    rep(i, N/3+1){
        ans += tmp * comb.i[i];
        ans %= M;
        if(i == N/3) continue;
        tmp *= comb.C(N-2*i, 2);
        tmp %= M;
    }
    return ans;
}

signed main(){
    cin >> N >> M;
    comb.init(3*N, M);
    ll ans = 0;
    ll tmp = 1;
    rep(i, N+1){
        ans += solve(3*(N-i)) * tmp % M * comb.i[i];
        ans %= M;
        if(i == N) continue;
        tmp *= comb.C(3*(N-i), 3) * 2;
        tmp %= M;
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/

/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}

bool s[405][405];
bool used[405][405];
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int main()
{
     ll n,m,d;
     cin>>n>>m>>d;
     ll t=(n-d);
     if(d!=0)t*=2;
     ld res=(double)(1.0*t/(1LL*n*n))*(m-1.0);
    cout<<fixed<<setprecision(10)<<res;
}

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
using namespace std;

int main() {

  string a, b, c;
  cin >> a >> b >> c;

  int ai = a.size() - 1;
  int bi = b.size() - 1;

  if (a[ai] == b[0] && b[bi] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<string, string> P;

string s;

void dfs(int i, int end, const string lTemp, const string rTemp, vector<P> &x)
{
    if (i == end)
    {
        x.push_back(make_pair(lTemp, rTemp));
        return;
    }

    dfs(i + 1, end, lTemp + s[i], rTemp, x);
    dfs(i + 1, end, lTemp, s[i] + rTemp, x);
}

bool compare(const P l, const P r)
{
    return l.first == r.first ? l.second < r.second : l.first < r.first;
}

int main(void)
{
    int n;
    cin >> n;
    cin >> s;
    reverse(s.begin() + n, s.end());

    vector<P> vl;
    vector<P> vr;
    dfs(0, n, "", "", vl);
    dfs(n, 2 * n, "", "", vr);
    sort(vl.begin(), vl.end());
    sort(vr.begin(), vr.end());

    long long score = 0;
    for (auto ia = vl.begin(); ia < vl.end(); ++ia)
    {
        auto ib_upper = upper_bound(vr.begin(), vr.end(), *ia);
        auto ib_lower = lower_bound(vr.begin(), vr.end(), *ia);
        score += ib_upper - ib_lower;
    }

    cout << score << endl;
    return 0;
}

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    vector<long long int> D(N);

    vector<long long int> Juwel(N);
    for (int i = 0; i < N; i++) {
        cin >> D.at(i);
    }
    int answer = 0, sum = 0 ;
    for (int action = 0; action <= K; action++) {
        for (int back = 0; back <= action; back++) {
            for (int left = 0; left <= action - back; left++) {
                Juwel.clear();
                sum = 0;
                if (left < (int)D.size()) {
                    for (int i = 0; i < left; i++)Juwel.push_back(D.at(i));

                    for (int i = 0; i < min(action - back - left, N - back - left); i++)Juwel.push_back(D.at(N - i - 1));
                }
                else {
                    for (int i = 0; i < (int)D.size(); i++)Juwel.push_back(D.at(i));
                }

                sort(Juwel.begin(), Juwel.end());

                for (int i = 0; i < min( back , (int)Juwel.size()); i++) {
                    if (Juwel.at(i) < 0)Juwel.at(i) = 0;
                }
                for (int i = 0; i <(int) Juwel.size(); i++)sum += Juwel.at(i);

                if (sum >= answer)answer = sum;
            }
        }
    }
    cout << answer << endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll A, B, C;

int main()
{
  std::cin >> A >> B >> C;

  if( A > B )
    std::swap(A,B);

  puts( A <= C && C <= B ? "Yes" : "No" );

  return 0;
}

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

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  if(a1 <= a3 && a3 <= a2 || a2 <= a3 && a3 <= a1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


#include <cstdio>
#define ll long long
ll mod = 1000000007;
ll big(ll b, ll p){
	if (p == 1) return b;
	ll h = big(b, p / 2);
	ll res = (h * h) % mod;
	if (p % 2 == 1) res = (res * b) % mod;
	return res;
}
int main(){
	ll n, m, k, ans = 1, x = 0, y = 0;
	scanf("%lld %lld %lld", &n, &m, &k);
	for (int i = 2; i < k; i++){
		ans *= (n * m) - i;
		ans %= mod;
	}
	for (int i = 1; i < n; i++){
		x += i * (n - i);
		x %= mod;
	}
	x = (x * m) % mod;
	x = (x * m) % mod;
	for (int i = 1; i < m; i++){
		y += i * (m - i);
		y %= mod;
	}
	y = (y * n) % mod;
	y = (y * n) % mod;
	ans = ans * (x + y) % mod;
	for (int i = k - 2; i > 1; i--){
		ans = (ans * big(i, mod - 2)) % mod;
	}
	printf("%lld\n", ans);
}

#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

constexpr ll inf = INT64_MAX / 4;
constexpr double pi = asin(1) * 2;
constexpr ll mod = 1000000007;

pair<ll, ll> extgcd(ll a, ll b) {
    if (b == 0)return make_pair(a, 0);
    auto t = extgcd(b, a % b);
    return make_pair(t.second, t.first - t.second * (a / b));
}

ll invmod(ll n) {
    return extgcd(n, mod).first;
}

class modint {
public:
    ll n;

    modint() = default;

    explicit modint(ll number) {
        n = ((number % mod) + mod) % mod;
    }

    bool operator==(modint e) {
        return n == e.n;
    }

    modint operator+(modint e) {
        return modint(n + e.n);
    }

    modint operator-(modint e) {
        return modint(n - e.n);
    }

    modint operator-(ll e) {
        return modint(n - e);
    }

    modint operator*(modint e) {
        return modint(n * e.n);
    }

    modint operator/(modint e) {
        return modint(n * invmod(e.n));
    }

};

template<class T>
T f1(T n, T m) {
    return m * m * (n * n * (n + T(1)) - (n * (n + T(1)) * (T(2) * n + T(1))) / T(3));
}

template<class T>
T f2(T n, T m) {
    return (f1(n, m) + f1(m, n)) / T(2);
}

template<class T>
T comb(T n, T k) {
    return k == T(0) ? T(1) : comb(n - T(1), k - T(1)) * n / k;
}

int main() {
    modint n, m, k;
    cin >> n.n >> m.n >> k.n;
    cout << (f2(n, m) * comb(n * m - 2, k - 2)).n << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

int main(){
    int n;
    cin >>n;
    vl a(n);
    rep(i,n) cin >> a[i];

    ll ans = 0;
    int tmp = a[0];
    rep(i,n-1){
        if(tmp > a[i+1]){
            ans += (tmp-a[i+1]);
        }else{
            tmp = a[i+1];
        }
    }

    cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin>>n;
    int t;
    cin>>t;
    long long int ans = 0, max = t;
    for(int i = 1; i < n; i++) {
        cin>>t;
        if(t < max) {
            ans += max-t;
        }
        else if(t > max) {
            max = t;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int dp[1005][1005]{};

int main() {
    string s,t;
    cin >> s >> t;
    REP(i,s.size()+1)fill(dp[i],dp[i]+t.size()+1,999999);
    REP(i,s.size()+1)dp[i][0] = i;
    REP(j,t.size()+1)dp[0][j] = j;
    REP(i,s.size()){
        REP(j,t.size()){
            if(s[i]==t[j])dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]);
            dp[i+1][j+1] = min(dp[i+1][j+1],dp[i+1][j]+1);
            dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j+1]+1);
            dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+1);
        }
    }
    cout << dp[s.size()][t.size()] << endl;
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {

  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;

  int ans = 0;
  string anss = "";

  cin >> a >> b;

  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
  ans = a+b;
  if(ans < a-b) ans = a-b;
  if(ans < a*b) ans = a*b;
  //else anss = "No";

  cout << ans << endl;

}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b

signed main(){
	ll n,k; cin>>n>>k;
	vl a(n);
	rep(i,0,n) cin>>a[i];
	rep(q,0,k){
		vl b(n+1);
		rep(i,0,n){
			ll s=max((ll)0,(i-a[i]));
			ll t=min(i+a[i]+1,n);
			b[s]++; b[t]--;
		}
		rep(i,1,n+1) b[i]+=b[i-1];
		b.pop_back();
		if(a==b) break;
		a=b;
	}
	rep(i,0,n) cout<<a[i]<<" ";

	return 0;
}

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> v[i];
	}

	ll ans = 0;
	for(int get_num = min(k, n); get_num >= 0; --get_num)
	{
		for(int start = -get_num; start <= 0; ++start)
		{
			ll sum = 0;
			vector<int> may_erase;
			for(int i = 0; i < get_num; ++i)
			{
				int val = v[start + i < 0 ? start + i + n : start + i];
				sum += val;
				if (val < 0) may_erase.emplace_back(val);
			}

			sort(may_erase.begin(), may_erase.end());
			int erase_num = min((int)may_erase.size(), k - get_num);
			ll erase_sum = 0;
			for(int i = 0; i < erase_num; ++i)
			{
				erase_sum += may_erase[i];
			}
			// cout << get_num << " " << start << " : " << sum << " - " << -erase_sum << endl;
			ans = max(ans, sum - erase_sum);
		}
	}
	cout << ans;

}

int main()
{
	fastio;
	solve();

	return 0;
}


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

int main(void) {
    long n, m;
    cin >> n >> m;
    vector<vector<long>> a(n, vector<long>(m));
    for(auto &l: a)
        for(auto &c: l)
            cin >> c, c--;

    long ok = 300, ng = 0;
    while(ok - ng > 1) {
        long mid = (ok+ng)/2;

        vector<long> idx(n);
        set<long> bad;

        while(1) {
            bool dame = false;

            for(long i=0; i<n; i++) {
                while(idx[i]<m && bad.count(a[i][idx[i]])) idx[i]++;
                if(idx[i] == m) {
                    dame = true;
                    break;
                }
            }
            if(dame) {
                ng = mid;
                break;
            }

            vector<long> cnt(m);
            for(long i=0; i<n; i++)
                cnt[a[i][idx[i]]]++;

            for(long i=0; i<m; i++)
                if(cnt[i] > mid)
                    bad.insert(i), dame = true;

            if(!dame) {
                ok = mid;
                break;
            }
        }
    }
    cout << ok << endl;
}

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

int N,M;
int FS[310][310];
vector<int>K;

int main(){
  cin>>N>>M;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>FS[i][j];
    }
  }
  for(int i=1;i<=M;i++){
    K.push_back(i);
  }
  int eachmaxcnt=0;
  int maxcnt=300;
  int C[310];
  int temp=0;

  //ゲームの種類分回す
  for(int i=0;i<M;i++){

    //各ゲームの参加者数を初期化
    for(int i=1;i<=M;i++){
      C[i]=0;
    }
      for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
          //最初にでてくるゲームの参加者を加算
          if(FS[i][j] != -1){
            C[FS[i][j]]++;
            break;
          }
        }
    }

    //最大参加者数を求める
    eachmaxcnt=0;
    for(int i=1;i<=M;i++){
      if(eachmaxcnt<C[i]){
        eachmaxcnt=C[i];
        temp=i;
      }
    }

    //最大参加者数の更新
    maxcnt=min(maxcnt,eachmaxcnt);

    //最大参加者のゲームを-1にする
    for(int i=0;i<N;i++){
      for(int j=0;j<M;j++){
        if(FS[i][j]==temp){
          FS[i][j]=-1;
        }
      }
    }
  }

  cout<<maxcnt<<endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int N = 0;
    cin >> N;
    int x = 0;
    cin >> x;
    vector<int> A(N,0);
    for(int i = 0; i < N; i++) {
    cin >> A.at(i);
    }

    int ans = 0;
    sort(A.begin(),A.end());
    for (size_t i = 0; i < N; i++)
    {
       // cout << x << endl;
        x -= A.at(i);
        //cout << x << endl;
        if (x < 0){
            break;
        }
        //cout << 52345234 << endl;
        ans++;
        /* code */

    }
    if(x>0)ans--;
    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long

void solve() {
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	sort(v.rbegin(), v.rend());

	int j = 0;
	ll x = 1;
	for (int i = 0; i < n; i++) {
		if (v[i] == v[i+1]) {
			x *= v[i];
			j++;
			i++;
			if (j == 2) {
				break;
			}
		}
	}
	if (j < 2) {
		x = 0;
	}
	cout << x << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}


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

int main(){
    string str;
    int i;
    int a, b;
    string order, str1;

    cin >> str >> i;
    for(int j=0;j<i;j++){
        cin >> order >> a >> b;
        if(order == "replace"){
            cin >> str1;
            for(int k=0;k<b-a+1;k++)str[a+k]=str1[k];
        } else if(order=="reverse"){
            while(b - a > 0){
                swap(str[a], str[b]);
                a++;b--;
            }
        }else{
            cout << str.substr(a, b - a + 1) << endl;
        }
        // cout << str << endl;
    }

    return 0;
}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
	for(int i=0; i<v.size(); i++) is >> v[i];
	return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;
	int n; cin >> n;
	vector<int> x(n), y(n);
	vector<char> u(n);
	for(int i=0; i<n; i++){
		cin >> x[i] >> y[i] >> u[i];
	}

	map<int, vector<int>> up, down, right, left;
	for(int i=0; i<n; i++){
		if(u[i]=='U') up[x[i]-y[i]].push_back(x[i]+y[i]);
		if(u[i]=='D') down[x[i]-y[i]].push_back(x[i]+y[i]);
		if(u[i]=='R') right[x[i]-y[i]].push_back(x[i]+y[i]);
		if(u[i]=='L') left[x[i]-y[i]].push_back(x[i]+y[i]);
	}

	int ans = 1e9;
	for(auto p: up){
		if(left.count(p.first)==0) continue;
		auto v = left[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	for(auto p: right){
		if(down.count(p.first)==0) continue;
		auto v = down[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	up.clear();
	down.clear();
	right.clear();
	left.clear();

	for(int i=0; i<n; i++){
		if(u[i]=='U') up[x[i]+y[i]].push_back(x[i]-y[i]);
		if(u[i]=='D') down[x[i]+y[i]].push_back(x[i]-y[i]);
		if(u[i]=='R') right[x[i]+y[i]].push_back(x[i]-y[i]);
		if(u[i]=='L') left[x[i]+y[i]].push_back(x[i]-y[i]);
	}

	for(auto p: right){
		if(up.count(p.first)==0) continue;
		auto v = up[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	for(auto p: down){
		if(left.count(p.first)==0) continue;
		auto v = left[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	up.clear();
	down.clear();
	right.clear();
	left.clear();

	for(int i=0; i<n; i++){
		if(u[i]=='U') up[x[i]].push_back(y[i]);
		if(u[i]=='D') down[x[i]].push_back(y[i]);
		if(u[i]=='R') right[y[i]].push_back(x[i]);
		if(u[i]=='L') left[y[i]].push_back(x[i]);
	}

	for(auto p: up){
		if(down.count(p.first)==0) continue;
		auto v = down[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	for(auto p: right){
		if(left.count(p.first)==0) continue;
		auto v = left[p.first];
		sort(v.begin(), v.end());
		for(int t: p.second){
			auto i = lower_bound(v.begin(), v.end(), t);
			if(i!=v.end()){
				ans = min(ans, 5*(*i-t));
			}
		}
	}

	if(ans == 1e9){
		cout << "SAFE" << endl;
	} else {
		cout << ans << endl;
	}

	return 0;
}


#include <queue>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define id(x,lev) x*52+lev
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
int mod = 998244353;
inline int mul(int x,int y){return 1ll*x*y%mod;}
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int sq(int x){return 1ll*x*x%mod;}
int pow(int a,int b){return b == 0 ? 1 : ( b&1 ? mul(a,sq(pow(a,b/2))) : sq(pow(a,b/2)));}
int n,su = 0,a[330],dp[90020] = {0},dp2[90020];
int main() {
	read(n);
	dp[0] = dp2[0] = 1;
	int ans = pow(3,n);
	for(int i=0;i<n;i++){
		read(a[i]);
		su+=a[i];
		for(int j=su;j>=0;j--){
			dp[j] = add(dp[j],dp[j]);
			if(j>=a[i]){
				dp[j] = add(dp[j],dp[j-a[i]]);
				dp2[j] = add(dp2[j],dp2[j-a[i]]);
			}
		}
	}
	for(int i=((su+1)/2);i<=su;i++){
		ans = sub(ans,mul(3,dp[i]));
	}
//	cout<<ans<<endl;
	if(su%2== 0){
		ans = add(ans,mul(dp2[su/2],3));
	}
	cout<<ans<<endl;
	return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

string A;

const int maxn = 100;
int freq[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> A;
    int n = A.length();
    for(int i = 0;i < n;i++){
        freq[A[i] - 'a']++;
    }
    ll ans = 1;
    for(int i = 0;i < 26;i++){
        for(int j = i + 1;j < 26;j++){
            ans += 1LL * freq[i] * freq[j];
        }
    }
    cout << ans << endl;
    return 0;
}

/*
 * X_Cubic.cpp
 *
 *  Created on: 2014/07/20
 *      Author: WanWan1985
 */
#include <iostream>
#include <math.h>
using namespace std;

int main(void) {
	// 入力値
	int iInput;
	cin >> iInput;

	// 実行
	double dOutput = pow((double)iInput, 3.0);

	// 出力
	cout << (int)dOutput << endl;

	return 0;
}