/*
https://atcoder.jp/contests/abc200/tasks/abc200_e

## 題意：

## 思路：

*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 0x3fffffff;
const ll LINF = 9223372036854775807;
#define dump(x) cout << #x << " = " << (x) << endl
#define ALL(x) begin(x),end(x)
#define rep(i,s,e) for(int i=(s); i<=(e); ++i)
#define repRev(i,s,e) for(int i=(s); i>=(e); --i)
#define range(i,s,n) for(int i=(s), i_stop=(s)+(n); i<i_stop; ++i)
#define rangeRev(i,s,n) for(int i=(s), i_stop=(s)-(n); i>i_stop; --i)
template<typename T> bool chmax(T& a, const T b) {if(a<b) {a=b;return true;} return false;}
template<typename T> bool chmin(T& a, const T b) {if(a>b) {a=b;return true;} return false;}

void solve() {
    int n; cin>>n;
    string s,t; cin>>s>>t;
    vector<int> a,b;
    range(i,0,n) if(s[i]=='0') a.push_back(i);
    range(i,0,n) if(t[i]=='0') b.push_back(i);
    if(a.size() != b.size()) {printf("-1\n"); return;}

    int ans=0;
    range(i,0,a.size()) if(a[i]!=b[i]) ++ans;
    cout<<ans<<endl;
}

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

#include <algorithm>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath>
#include <cstdlib> // abs(int)
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define roundup(n, d) (((n) + ((d)-1)) / (d))
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i, n) for (long long i = 0; i < (long long)n; ++i)
#define v_in(v)        \
    for (auto&& i : v) \
    cin >> i
#define vv_in(vv) rep(I, (long long)vv.size()) for (auto&& J : vv[I]) cin >> J
#define FAST_IO                  \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(), v.end()
#define printvar(x) cout << #x << ":" << x << endl

#define PI 3.14159265358979323846

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;

int main(void) {
    FAST_IO

    ll n;
    cin >> n;
    unordered_set<string> bang;
    unordered_set<string> notbang;

    bang.reserve(n);
    notbang.reserve(n);

    rep(i, n) {
        string str;
        cin >> str;
        if (str[0] == '!') {
            string tempstr = str.substr(1);
            if (notbang.find(tempstr) != notbang.end()) {
                cout << tempstr << endl;
                return 0;
            }
            bang.emplace(tempstr);
        } else {
            if (bang.find(str) != bang.end()) {
                cout << str << endl;
                return 0;
            }
            notbang.emplace(str);
        }
    }
    cout << "satisfiable" << endl;
    return 0;
}


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

#define LOCAL
//Credit: Errichto's debug template
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long int;
using ld = long double;
using vi = vector<int>;
using mii = map<int, int>;
using pii = pair<int, int>;

const int inf = 1e9;
const int N = 100005;
const ll mod = (ll) 1e9 + 7;
const ll mod2 = (ll) 998244353;

void test(){
	int n;
	cin >> n;
	vi arr(n);

	for(int i = 0; i < n; i++)
		cin >> arr[i];

	set<int> s;

	for(int i = 0; i <= n; i++)
		s.insert(i);

	for(int i = 0; i < n; i++){
		if(s.find(arr[i]) != s.end())
			s.erase(arr[i]);

		int ans = *s.begin();
		cout << ans << '\n';
	}
}

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

    int tt = 1;
    //cin >> tt;
    while(tt--){
    	test();
    }

    return 0;
}

/*

 */

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

int main(void) {
  int n;
  cin >> n;
  vector<long long> xs(n);
  for (long long &x : xs) cin >> x;
  long long result0 = 0;
  long long result1 = 0;
  long long result2 = 0;
  for (int i = 0; i < n; ++i) {
    result0 += abs(xs[i]);
    result1 += xs[i] * xs[i];
    result2 = max(result2, abs(xs[i]));
  }

  double result1a = sqrt(result1);

  cout << setprecision(10);
  cout << result0 << endl << result1a << endl << result2 << endl;
  return 0;
}


#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define overload4(_1, _2, _3, _4, name, ...) name
#define overload3(_1, _2, _3, name, ...) name
#define rep1(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = n; i--;)
#define rrep2(i, n) for (ll i = n; i--;)
#define rrep3(i, a, b) for (ll i = b; i-- > (a);)
#define rrep4(i, a, b, c) for (ll i = (a) + ((b) - (a)-1) / (c) * (c); i >= (a); i -= c)
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define elif else if
ll beki(ll i)
{
    return 1ll << i;
}
#define skip(M) \
    if (M)      \
    continue
#define all(v) v.begin(), v.end()
#define allm(x, y, M) for (auto [(x), (y)] : (M))
#define alls(i, S) for (auto(&i) : (S))
#define pb push_back
#define fi first
#define se second
#pragma warning(disable : 4312)
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MAX_N1 = 200010;
const ll MAX_N2 = 500010;
template <class X>
void print(X x)
{
    cout << x << endl;
}
void print(vl x)
{
    for (ll i : x)
    {
        cout << i << " ";
    }
    cout << endl;
}
void print(vector<PP> x)
{
    for (PP i : x)
    {
        cout << i.first << " " << i.second << endl;
    }
    cout << endl;
}
template <class X>
int lbound(vector<X> &Y, X a)
{
    return lower_bound(all(Y), a) - Y.begin();
}
template <class X>
int ubound(vector<X> &Y, X a)
{
    return upper_bound(all(Y), a) - Y.begin();
}
template <class X>
X lbound2(vector<X> &Y, X a, int mode = 0)
{
    int x = lbound(Y, a) - mode;
    if (x < 0 || x >= Y.size())
        return INF;
    return Y[x];
}
template <class X>
X ubound2(vector<X> &Y, X a, int mode = 0)
{
    int x = ubound(Y, a) - mode;
    if (x < 0 || x >= Y.size())
        return INF;
    return Y[x];
}
template <class... T>
void zero(T &...t)
{
    (..., (t = 0));
}
template <class... T>
void cl(T &...t)
{
    (..., (t.clear()));
}
template <class... T>
void in(T &...t)
{
    (..., (cin >> t));
}
template <class... T>
void put(vl &V, int n)
{
    ll k;
    rep(i, n)
    {
        cin >> k;
        V.pb(k);
    }
}
int max_index(vl &V)
{
    return max_element(all(V)) - V.begin();
}
int min_index(vl &V)
{
    return min_element(all(V)) - V.begin();
}
ll sum(vl &V)
{
    return accumulate(all(V), 0ll);
}
void Uni(vl &V)
{
    V.erase(unique(all(V)), V.end());
}
template <class X>
bool ma(X &a, X b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class X>
bool mi(X &a, X b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
void vset(vl &A, ll n, ll k)
{
    A = vl(n, k);
}
void so(vl &A)
{
    sort(all(A));
}
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, m, u, v;
ll codeforces = 1;
string S, T;
vl A, B, C, D, ANS;
vector<PP> VP, VP2;
set<ll> s1, s2;
void solve()
{
    long double x1, x2, y1, y2;
    in(n);
    in(x1, y1, x2, y2);
    long double kk = M_PI / (n / 2);
    long double a1 = (x1 + x2) / 2, a2 = (y1 + y2) / 2, b1 = x1 - a1, b2 = y1 - a2;
    long double c1 = cos(kk) * b1 - sin(kk) * b2, c2 = sin(kk) * b1 + cos(kk) * b2;
    //cout << a1 << " " << a2 << endl;
    //cout << c1 << " " << c2 << endl;
    cout << a1 + c1 << " " << a2 + c2 << endl;
}
int main()
{
    cout << fixed << setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cin >> codeforces;
    while (codeforces--)
    {
        solve();
    }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
char inverse_char(char c) {
  if(isupper(c)) return tolower(c);
  else return toupper(c);
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  ll to, cost;
};

#define PI 3.141592653589793

double ansx(double x1, double y1, double x2, double y2, double degree) {
  double rty = degree * PI / 180.0;
  // cout << rty << " " << sin( rty ) << endl;
  double atai_x = (x2 - x1) * cos( rty ) - (y2 - y1) * sin( rty );
  return atai_x;
}

double ansy(double x1, double y1, double x2, double y2, double degree) {
  double rty = degree * PI / 180.0;
  double atai_y = (x2 - x1) * sin( rty ) + (y2 - y1) * cos( rty );
  return atai_y;
}

int main() {
  double N; cin >> N;
  double x0, y0; cin >> x0 >> y0;
  double x2, y2; cin >> x2 >> y2;
  double cx = 0.0; double cy = 0.0;
  cx = (x0 + x2) / 2.0; cy = (y0 + y2) / 2.0;
  double theta = 360.0 / N;
  // cout << cx << " " << cy << " " << theta << endl;
  cout << fixed << setprecision(10) << ansx(cx, cy, x0, y0, theta) + cx << " " << ansy(cx, cy, x0, y0, theta) + cy << endl;
}


#include<bits/stdc++.h>
using namespace std;
long long int B,C;
int main(){
	scanf("%lld%lld",&B,&C);
	if(C==0)printf("1\n");
	else{
	if(B>0){
	long long int zl=B-C/2,fl;
	if(C%2==1){
		fl=-zl;
	}
	else{
		fl=-zl-1;
	}
	long long int fr=-B-(C-1)/2,zr;
	if((C-1)%2==1){
		zr=-fr;
	}
	else{
		zr=-fr-1;
	}
	zr=max(zr,B);
	if(fl>=zl)printf("%lld\n",zr-fr+1);
	else printf("%lld\n",zr-zl+1+fl-fr+1);
	}
	else if(B<0){
	long long int fr=B-C/2,zr;
	if(C%2==1){
		zr=-fr;
	}
	else{
		zr=-fr-1;
	}
	long long int zl=-B-(C-1)/2,fl;
	if((C-1)%2==1){
		fl=-zl;
	}
	else{
		fl=-zl-1;
	}
	fl=max(fl,B);
	if(fl>=zl)printf("%lld\n",zr-fr+1);
	else printf("%lld\n",zr-zl+1+fl-fr+1);
	}
	else{
		printf("%lld\n",((C-1)/2)+(C/2)+1);
	}
	}
	return 0;
}

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

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

#define mod         1000000007
#define pi          3.1415926535898
#define eps         1e-9

#define fast       ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define vt vector
#define ar array
#define fs          first
#define sc          second
#define pb         push_back
#define sp          printf(" ")
#define nl          '\n'
#define all(a) a.begin(),a.end()
#define unique(c) (c).resize(unique(all(c)) - (c).begin())
#define sz(x) (int)(x).size()
#define revsort(x) sort(all(x));reverse(all(x))

#define REP(i,start,end) for (int i = start; i <=end; i++)
#define RREP(i,end,start) for (int i=end; i>=start ;i--)
#define EACH(x, a) for (auto& x: a)

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<LL> vll;
typedef vector<double> vd;
typedef vector<vector<LL> > matrix;
typedef vector<vector<int> > graph;

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);
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int add (LL var1, LL var2) {
    return ( (var1 % mod) + (var2 % mod) + mod) % mod;
}

int mul (LL var1, LL var2) {
    return (var1*var2) % mod;
}

int powm (LL x, LL y) {
    int ans = 1;
    while (y) {
        if (y & 1) {
            ans = mul(ans, x);
        }
        x = mul(x, x);
        y /= 2;
    }
    return ans;
}

int inv(LL x) {
    return powm(x, mod-2);
}

LL INF=1e9;

void solve() {
    LL b, c;
    read(b, c);
    set <pll> s;

    s.insert({b - c/2, b});
    s.insert({b, b + (c-2)/2});
    s.insert({-b - ((c-1)/2), -b});
    s.insert({-b, -b + ((c-1)/2)});

    LL left = -4e18;
    LL ans = 0;

    for (auto px : s) {
        LL l = px.fs;
        LL r = px.sc;
        // cerr << l << " " << r <<nl;
        if (l <= left) {
            l = left + 1;
        }
        ans += max(0LL, r - l + 1);
        left = r;
    }
    cout << ans << nl;
}

int main() {
    fast;
        solve();
}


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

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define dbg(x) cerr<<#x<<" : "<<x<<endl

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 998244353L;
clock_t time_p=clock();
void timer(){time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}

template <typename Arg1> ostream& operator << (ostream& out, const vector<Arg1> &a) {out<<"[ ";for(const auto &x:a)out<<x<<" ";return out<<"]";}

ll po(ll a,ll b, ll mod=MOD){
    if(b==0) return 1;
    ll x = po(a,b/2,mod);
    if(b%2){
        return (((x*x)%mod)*a)%mod;
    } else {
        return (x*x)%mod;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vi f(n);
    rep(i,n) cin>>f[i];
    rep(i,n) f[i]--;
    vi state(n,0);
    ll c = 0;
    vector<set<int>>adj(n);
    rep(i,n){
        adj[i].insert(f[i]);
        adj[f[i]].insert(i);
    }
    vi visited(n,0);
    rep(start, n){
        if(visited[start] == 0){
            c++;
            queue<int>s;
            s.push(start);
            while(!s.empty()){
                ll cur = s.front();
                visited[cur] = 1;
                for(auto next : adj[cur]){
                    if(visited[next] == 0){
                        visited[next] = 1;
                        s.push(next);
                    }
                }
                s.pop();
            }
        }
    }
    cout<<(po(2,c,MOD)-1+MOD)%MOD<<endl;
    timer();
    return 0;
}

#include <iostream>
#include <vector>
#include <set>

// 引用元 : https://qiita.com/ofutonfuton/items/c17dfd33fc542c222396
struct UnionFind {
  std::vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++) par[i] = i;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main()
{
  int N;
  std::cin >> N;

  UnionFind uf(N + 1);

  for (int i = 1; i <= N; i++)
  {
    int n;
    std::cin >> n;
    uf.unite(i,n);
  }

  std::set<int> groups;
  for (int i = 1; i <= N; i++)
  {
    groups.insert(uf.root(i));
  }

  long long mod = 998244353;

  long long ans = 1;
  for (int i = 0; i < groups.size(); i++)
  {
    ans *= 2;
    ans %= mod;
  }

  ans += mod;
  ans -= 1;
  ans %= mod;

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


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

const int mod = 1e9 + 7;
struct mint {
    ll x;
    mint (ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator -() const {return mint(-x);}
    mint& operator +=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator -=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator *=(const mint a) {(x *= a.x) %= mod; return *this;}
    mint operator +(const mint a) const {return mint(*this) += a;}
    mint operator -(const mint a) const {return mint(*this) -= a;}
    mint operator *(const mint a) const {return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {return pow(mod - 2);}
    mint operator /=(const mint a) {return *this *= a.inv();}
    mint operator /(const mint a) {return mint(*this) /= a;}
};
istream& operator >>(istream &is, mint &a) {return is >> a.x;}
ostream& operator <<(ostream &os, const mint &a) {return os << a.x;}

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    a.erase(unique(all(a)), a.end());
    sort(rall(a));
    a.push_back(0);
    mint ans = 1;
    rep(i,a.size()-1) {
        ans *= a[i] - a[i + 1] + 1;
    }
    cout << ans << endl;
}

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int lli;

int A,B,W;

int main()
{
    string s;
    cin >> s;
    long long x = std::stoll(s);
    int digit;
    int L = s.size();
    long long int cnt = (L-1) / 3;

    long long int sum =(long long int)cnt* x;
    for (int j=cnt;j>=1;j--)
    {

        long long int l = 1;
        for (int i=1;i<=j;i++)
        {
            l *= 1000;
        }
        l--;

        sum -=  l;
    }
    printf("%lld\n", sum);
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plp;
typedef pair<pll,ll> ppl;
typedef pair<pll,pll> ppp;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pll> vpll;
typedef vector<plp> vplp;
typedef vector<ppl> vppl;
typedef vector<ppp> vppp;
typedef vector<vpll> vvpll;
typedef vector<bool> vbool;
typedef vector<vbool> vvbool;
typedef vector<double> vd;
typedef priority_queue<pll,vpll,greater<pll> > pqpll;
typedef priority_queue<pll,vpll> pqrpll;
typedef priority_queue<ll, vll, greater<ll> > pqll;
typedef priority_queue<ll, vll> pqrll;

struct edge{ ll to,cost; edge(ll to,ll cost): to(to), cost(cost){} };
typedef vector<vector<edge>> Graph;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF 1000000000000000000
#define INF 1000000000
#define fs first
#define sc second
#define EPS 1e-10
#define ALL(a) a.begin(), a.end()

template<typename T> ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T> ll sz(priority_queue<T, vector<T> > &pq) {return (ll)pq.size(); }
template<typename T> ll sz(priority_queue<T, vector<T>, greater<T> > &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); }

void chmin(ll &a, ll &b) { if(a > b) a = b; }
void chmax(ll &a, ll &b) { if(a < b) a = b; }

ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
ll dx[4] = {0,-1,1,0},dy[4] = {-1,0,0,1};
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll t;
    cin >> t;
    rep(i,0,t){
        string s,t;
        cin >> s;
        string memo = "atcoder";

        t = s;
        sort(ALL(t),greater<char>());

        if(memo < s) cout << 0 << endl;
        else if(memo >= t) cout << -1 << endl;
        else{
            ll ans = LINF;
            rep(i,0,sz(memo)){
                rep(j,i,sz(s)){
                    if(s[j] > memo[i]){
                        ans = min(ans,j-i);
                        break;
                    }
                }
                if(s[i] < memo[i]) break;
            }
            cout << ans << endl;
        }
    }

    return 0;
}

/*
                Kids were laughing in my classes
                While I was scheming for the masses
                Who do you think you are?
                Dreaming 'bout being a big star
                They say you're basic, they say you're easy
                You're always riding in the back seat
                Now I'm smiling from the stage while
                You were clapping in the nose bleeds
                Thunder
                Thunder, thun', thunder
                Thun-thun-thunder, thunder, thunder
                Thunder, thun', thunder
                Thun-thun-thunder, thunder
                Thunder, feel the thunder
                Lightning then the thunder
                Thunder, feel the thunder
                Lightning then the thunder
                Thunder
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define sec second
#define pb push_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define me(i,x,n) for( i=x;i<n;i++)
#define she(i,x,n) for( i=x;i>=0;i--)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define thunder ios_base::sync_with_stdio(false);cin.tie(NULL);
#define try cin>>t;while(t--)
#define PI (ld)3.141592653589793238
#define INF LLONG_MAX
#define MAX 100005
#define make_graph(k) ll x,y; me(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
int main()
{
    thunder
      #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      #endif
	ll t,n,m,i,s,j,k,c;
	//try

	    s=0;
	    cin>>n;
	    vector <ll> vec(n);
	    me(i,0,n)
	    cin>>vec[i];
        ll p=pow(2,n);
        s=INF;
    for(i=0;i<p;i++)
    {
        ll ans=0;
        ll c=0;
        for(j=0;j<n;j++)
        {

            if((i&(1<<j))!=0)
            {
                c=c|vec[j];
                ans=ans^c;
                c=0;
            }
            else
            c=c|vec[j];
        }
        ans=ans^c;
        s=min(s,ans);
    }
    cout<<s<<endl;

	return 0;
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll power(ll x, ll y, ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(ll a, ll m)
{
    //ll g = gcd(a, m);
    return  power(a, m-2, m);
}

//WHY ARE YOU STALKING?


#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int t; cin >> t;
    while (t--) {
        int n; cin >> n;
        vector<string> s(3);
        REP(i, 0, 3) cin >> s[i];

        cout << string(n, '0') << string(n, '1') << '0' << endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

bool solve(vector<ll> &A) {
    ll N = A.size();
    vector<ll> ans;
    REP(i, N * N) {
        bool sorted = true;
        REP(j, N - 1) {
            if (A[j] > A[j + 1]) {
                sorted = false;
                break;
            }
        }
        if (sorted)
            break;
        bool update = false;
        REP(j, N) {
            if (i % 2 != j % 2)
                continue;
            if (j + 1 >= N)
                break;
            if (A[j] > A[j + 1]) {
                update = true;
                swap(A[j], A[j + 1]);
                ans.push_back(j);
                break;
            }
        }
        if (!update) {
            for (ll j = N - 2; j >= 0; --j) {
                if (j % 2 == i % 2) {
                    swap(A[j], A[j + 1]);
                    ans.push_back(j);
                    break;
                }
            }
        }
#if false
        REP(j, N) {
            cout << A[j] << " ";
        }
        cout << endl;
#endif
    }

    cout << ans.size() << endl;
    REP(i, ans.size()) {
        cout << ans[i] + 1 << " ";
    }
    cout << endl;
    {
        bool sorted = true;
        REP(j, N - 1) {

            if (A[j] > A[j + 1]) {
                sorted = false;
                break;
            }
        }
        return sorted;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
#if true
    ll Q;
    cin >> Q;
    REP(_, Q) {
        ll N;
        cin >> N;
        vector<ll> A(N);
        REP(i, N) {
            cin >> A[i];
        }
        if (!solve(A)) {
            assert(false);
        }
    }
#else
    vector<ll> A;
    ll N = 8;
    REP(i, N) {
        A.push_back(i + 1);
    }
    do {
        vector<ll> v;
        REP(i, N) {
            v.push_back(A[i]);
        }
        if (!solve(v)) {
            assert(false);
        }
    } while (next_permutation(A.begin(), A.end()));
#endif
    return 0;
}


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

struct UnionFind{
    vector<int> p,r;
    UnionFind(int n){
        p.resize(n, -1);
        r.resize(n,  1);
    }

    int find(int x){
        if(p[x] == -1) return x;
        else return p[x] = find(p[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(r[x] > r[y]) swap(x,y);
        if(r[x] == r[y]) r[y]++;
        p[x] = y;
    }
};

ll mod = 998244353;
ll modpow(ll a,ll b){
    ll ans = 1;
    a %= mod;
    while(b){
        if(b&1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

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

    int N; cin >> N;
    UnionFind uf(N);
    vector<int> f(N);
    rep(i,N){
        cin >> f[i];
        f[i]--;
        uf.unite(i, f[i]);
    }
    set<ll> se;
    rep(i,N) se.insert(uf.find(i));
    ll cnt = se.size();
    cout << modpow(2, cnt) - 1 << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,n,a) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl//デバッグ用
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define pb push_back
#define F first
#define S second
typedef long long ll;
//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
//a.erase(unique(all(a)), a.end()); ソート後に重複を削除
//cout<< std::fixed << std::setprecision(15)<<0.000001<<endl; 小数点以下を表示させる
//vector<vector<int>> data(3, vector<int>(4)); int型の2次元配列(3×4要素の)の宣言

int main() {
    ll ans=1;
    ll loopnum=0;
    int n;
    cin>>n;
    vector<int> f(n);
    vector<bool> isLooked(n);

    int fff;
    rep(i,0,n){
        cin>>fff;
        f.at(i)=fff-1;
    }

    rep(i,0,n){
    if(isLooked.at(i)){continue;}
    int nowplace=i;
    //db(i);
    set<int> iFoundedPlace;
    while(true){

    //db(nowplace);

    iFoundedPlace.insert(nowplace);
    //db(iFoundedPlace.size());
    nowplace=f.at(nowplace);

    if(isLooked.at(nowplace)){
        for(auto x : iFoundedPlace) {
        isLooked.at(x)=true;
        }
        break;
    }

    if(iFoundedPlace.count(nowplace)==1){
        for(auto x : iFoundedPlace) {
        isLooked.at(x)=true;
        }
        loopnum++;
        break;
    }

    }

    }
    rep(i,0,loopnum){
        ans*=2;
        ans%=998244353;
    }
    cout<<(ans%998244353)-1<<endl;

    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>
#include <numeric>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

vector<vector<ll>> v;

// 順列を全通り生成
void p(ll i)
{

}

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;

    for (ll i = 0; i < n; i++)
    {
        vector<ll> temp;
        for (ll j = 0; j < n; j++)
        {
            ll t;
            cin >> t;
            temp.push_back(t);
        }
        v.push_back(temp);
    }

    ll ans = 0;

    vector<int> nums(n - 1);
    iota(nums.begin(), nums.end(), 0);

    do
    {
        ll sum = 0;
        sum += v[0][nums[0] + 1];
        for (ll i = 0; i < n - 2; i++)
        {
            // cout << nums[i] + 1 << " " << nums[i + 1] + 1 << endl;
            sum += v[nums[i] + 1][nums[i + 1] + 1];
        }

        sum += v[nums.back() + 1][0];

        // cout << sum << endl;

        if (sum == k)
        {
            ans++;
        }
    } while (next_permutation(nums.begin(), nums.end()));

    cout << ans << endl;
}

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

const int maxn=200005;
const int inf=1ll<<60;

struct Node {
	int w,v;
	bool operator < (const Node &rhs) const {
		return v>rhs.v;
	}
} a[maxn];

int top;
int x[maxn];
int st[maxn];
int vis[maxn];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int n,m,q;
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++) {
		cin>>a[i].w>>a[i].v;
	}
	for(int i=1;i<=m;i++) {
		cin>>x[i];
	}
	sort(a+1,a+n+1);
	while(q--) {
		int l,r;
		cin>>l>>r;
		top=0;
		for(int i=1;i<=l-1;i++) {
			st[++top]=x[i];
		}
		for(int i=r+1;i<=m;i++) {
			st[++top]=x[i];
		}
		sort(st+1,st+top+1);
		memset(vis,0,sizeof(vis));
		int ans=0;
		for(int i=1;i<=n;i++) {
			int pos=-1;
			for(int j=top;j>=1;j--) {
				if(!vis[j]&&st[j]>=a[i].w) {
					pos=j;
				}
			}
			if(pos!=-1&&pos<=top&&st[pos]>=a[i].w) {
				vis[pos]=1;
				ans+=a[i].v;
			}
		}
		cout<<ans<<"\n";
	}
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a))
#define MEM_1(a) memset((a),-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define COMPRESS(a) sort(ALL(a));a.resize(unique(ALL(a))-a.begin())
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<ld> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 };

char s[100005];
int d[100005],d2[26];
int main(){
	int n;
	scanf("%d%s",&n,s);
	fup(i,0,n-1,1)d[i]=INF;
	fup(i,0,25,1)d2[i]=INF;
	fdn(i,n-2,0,1){
		if(s[i]!=s[n-1])d[i]=1;
		fup(j,0,25,1){
			if(s[i]-'a'!=j)d[i]=min(d[i],1+d2[j]);
		}
		if(i>0)d2[s[i-1]-'a']=min(d2[s[i-1]-'a'],d[i]);
	}
	printf("%d\n",d[0]==INF?-1:d[0]);
}

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

template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

#ifdef DEBUG
#define debug(args...) _debug(args)
void _debug(const char* format, ...) {
	va_list args;
	va_start(args, format);
	vprintf(format, args);
	va_end(args);
}
#else
#define debug(args...)
#endif

#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 200005

int n;
char s[MAXN];

int main() {
	scanf("%d", &n);
	scanf(" %s", s);
	if (s[0] != s[n - 1]) {
		printf("1\n");
		return 0;
	}
	REP (i, 2, n - 1) {
		if (s[i - 1] != s[0] && s[i] != s[0]) {
			printf("2\n");
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[100005],b[100005],cnt=0;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
	}
	for(int i=1;i<=n;i++)
	{
		cnt+=(a[i]*b[i]);
	}
	if(cnt==0)
	{
		printf("Yes\n");
	}else
	{
		printf("No\n");
	}
}

#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cassert>
#include <random>
#include <chrono>

/* #include <atcoder/all> */
/* using namespace atcoder; */
using namespace std;

void debug_out(){ cout << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1000000007;
/* const ll MOD = 998244353; */
const ll INF = 1ll<<60;
const double PI = acos(-1);

struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

signed main() {
  int N;
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  vector<int> B(N);
  REP(i, N) cin >> B[i];

  int ans = 0;
  REP(i, N){
    ans += A[i]*B[i];
  }

  if(ans == 0) Yes;
  else No;

  return 0;
}


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

inline int read()
{
	int w=1,x=0;char f=getchar();
	while(!isdigit(f) && f!='-') f=getchar();
	if(f=='-') {w=-1;f=getchar();}
	while(isdigit(f)) {x=(x<<3)+(x<<1)+f-48;f=getchar();}
	return w*x;
}

int a,b,c,d;
double sx,sy,gx,gy;
double ans,h1,h2,l,l1,l2;
int main()
{
	a=read();b=read();
	c=read();d=read();
	sx=a;sy=b;gx=c;gy=d;
	h1=abs(sy);h2=abs(gy);
	l=abs(sx-gx);
	l1=l*(h1/(h1+h2));
	ans=sx<gx?sx+l1:sx-l1;
	printf("%.10lf",ans);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

// using mint = long double;
// using mint = modint998244353;
// using mint = modint1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 1e18;
const ll fact_table = 3200008;

priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)
#define rep2(i, a, b) for (ll i = a; i <= (b); i++)
#define rep3(i, a, b) for (ll i = a; i >= (b); i--)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= m; b >>= 1;}(x *= a) %= m; b--;} return x;}
vec readvec(ll read) { vec res(read); for (int i = 0; i < read; i++) { cin >> res[i]; } return res;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/

bool icpc = false;
bool multicase = false;

ll n, m, k;;

bool solve() {
    double sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    double ans = gx - (gx - sx) * (gy) / (sy + gy);
    ps(ans);
    return true;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    if (icpc) {
        while (solve());
        return 0;
    }
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }

// solve();
    return 0;
}


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

int main() {
    int K;
    int64_t ans = 0;
    cin >> K;
    for(int a = 1; a*a*a <= K; a++) {
        for(int b = a; a*b*b<=K; b++) {
            int cmax = K/(a*b);
            if(a==b) {
                ans += 1+(cmax-b)*3;
            }
            else{
                ans += 3+(cmax-b)*6;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n)-1;i >= 0;i--)
#define repr(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (x).size()

constexpr ll mod = 998244353;

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

ll inv(ll x){
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while(k){
        if(k&1)res = (res*y)%mod;
        y = (y*y) % mod;
        k /= 2;
    }
    return res;
}

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

    ll k;
    cin >> k;

    ll ret = 0;

    repr(i,1,k) {
        ll bc = k/i;
        repr(j,1,bc) {
            ret += bc/j;
        }
    }

    cout << ret << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Data {
    ll x, y, z;
};
Data D[105];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    REP(i, M) {
        cin >> D[i].x >> D[i].y >> D[i].z;
        //D[i].x--;
    }

    ll MAX = (1LL << N);
    vector<bool> U(MAX, false);
    REP(bit, MAX) {
        vector<ll> count(N + 1, 0);
        ll cnt = 0;
        REP(i, N) {
            if ((bit >> i) & 1) {
                count[i + 1]++;
                cnt++;
            }
        }
        REP(i, N) {
            count[i + 1] += count[i];
        }

        U[bit] = true;
        REP(i, M) {
            if (D[i].x != cnt)
                continue;
            if (count[D[i].y] > D[i].z) {
                U[bit] = false;
                break;
            }
        }
    }
    vector<vector<ll>> dp(N + 2, vector<ll>(MAX, 0));
    dp[0][0] = 1;
    REP(i, N) {
        REP(bit, MAX) {
            if (dp[i][bit] == 0)
                continue;
            REP(j, N) {
                if (((bit >> j) & 1) == 1)
                    continue;
                ll nxt = (bit | (1LL << j));
                if (!U[nxt])
                    continue;
                dp[i + 1][nxt] += dp[i][bit];
            }
        }
    }

    cout << dp[N][MAX - 1] << endl;
    return 0;
}

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

int mod = 1000000007;

int main(){
  int N, M;
  cin >> N >> M;
  int64_t dp[1<<N];
  vector<vector<int>> joken(M,vector<int>(3));
  for(int i = 0;i < M;i++)
    cin >> joken[i][0] >> joken[i][1] >> joken[i][2];
  sort(joken.begin(),joken.end());
  for(int i = 0;i < (1 << N);i++)
    dp[i] = 0;
  dp[0] = 1;
  for(int i = 0;i < (1 << N);i++){
    bitset<20> b(i);
    int c = b.count();
    bool ok = false;
    for(int j = 0;j < M;j++){
      if(joken[j][0] >= c){
        int d = 0;
        for(int k = 0;k < joken[j][1];k++)
          if(b.test(k)) d++;
        if(d > joken[j][2]){
          ok = true;
          break;
        }
      }
    }
    if(ok){
      continue;
    }
    for(int j = 0;j < N;j++){
      if(b.test(j) == false)
        dp[i + (1 << j)] += dp[i];
    }
  }
  cout << dp[(1 << N) - 1] << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

int N, M;

int main()
{
    cin >> N >> M;
    int ret = 0;

    auto S = new string[N];
    //auto Sones = new int[N];
    //auto Sbits = new std::bitset<20>[N];
    uint64_t nOdd = 0, nEven = 0;
    for (auto i = 0; i < N; i++)
    {
        cin >> S[i];
        //Sones[i] = std::bitset<20>(S[i]).count();//std::count(S[i].cbegin(), S[i].cend(), '1');
        //Sbits[i] = std::bitset<20>(S[i]);
        if (std::bitset<20>(S[i]).count() % 2 == 0)
        {
            nEven++;
        }
        else
        {
            nOdd++;
        }
    }

    cout << nEven * nOdd << endl;
}

//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<unordered_map>
#define endl                 '\n'
#define PI              	acos(-1.0)
#define pf              	printf
#define sf            		scanf
#define ff 					first
#define ss					second
#define pb 					push_back
#define mk 					make_pair
#define ll 					long long
#define VI              	vector<long long>
#define pr 					pair<long long,long long>

#define sf1(a)              scanf("%d", &a)
#define sf2(a,b)            scanf("%d %d",&a, &b)
#define sf3(a,b,c)          scanf("%d %d %d", &a, &b, &c)

#define sl1(a)              scanf("%I64d", &a)
#define sl2(a,b)            scanf("%I64d %I64d", &a, &b)
#define sl3(a,b,c)			scanf("%I64d %I64d %I64d", &a, &b, &c)

#define SET(a,x)          	memset( a, x,    sizeof(a) )
#define SETV(a,x)         	memset(a.begin(), a.end(),x )
#define REP(i,a,b)       	for(long long i=a;i<b;i++)
#define all(x)              (x).begin(), (x).end()
#define sz(x)      			((int)x.size())
#define tc(cn) 				pf("Case %d: ",cn)

#define M 					10000007
#define INF                 2147483647

#define sqr(x)           	(x)*(x)
#define gcd(a, b)        	__gcd(a, b)
#define lcm(a, b)        	((a)*((b)/gcd(a,b)))

#define fio 				ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
inline void Time() { cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s. \n";}

void solve()
{

	ll n;
	cin >> n;
	VI a(n), b(n), ans;

	for (ll &x : a)cin >> x;
	for (ll &x : b)cin >> x;

	unordered_map<ll, ll>un;
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		ll x = a[i];
		ll y = b[i];

		for (int k = x; k <= y; k++)
		{
			un[k]++;
			if (un[k] == n)count++;
		}

	}

	cout << count << endl;

}

int main()
{	//fio;

solve();

	//pf("\n\n\n\n"); Time();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
namespace math{
    const int MOD = 1e9+7;
    const int MN = 10'100;
    int fact[MN], inv_fact[MN];
    int power(int a, int n) {
        int res = 1;
        for (;n; n >>= 1, a = (a * a) % MOD) if (n & 1) res = (res * a) % MOD;
        return res;
    }
    int inv(int a) { return inv_fact[a]*fact[a-1]%MOD; }
    void init_fact() {
        fact[0]=1;
        for (int i=1;i<MN;++i) fact[i] = fact[i-1]*i%MOD;
        inv_fact[MN-1] = power(fact[MN-1], MOD - 2);
        for (int i=MN-1; i>0;--i) inv_fact[i-1]=inv_fact[i]*i%MOD;
    }
    struct mint {
        int n;
        mint(int n): n(n){}
        mint(): n(0){}
        mint operator+(mint o){return (n + o.n) % MOD;}
        mint operator-(mint o){return (n - o.n % MOD + MOD) % MOD;}
        mint operator*(mint o){return (n * o.n) % MOD;}
        mint operator/(mint o){return o.n >= MN ? n * power(o.n, MOD - 2) % MOD : n * inv(o.n) % MOD;}
    };
};
using namespace math;
using mat = vector<vector<mint>>;
int n, m, k;
vector<int> g[100];
mat M;
mat operator*(mat A, mat B)
{
    mat ret(A.size(), vector<mint>(B[0].size()));
    for (int i = 0; i < A.size(); ++i)
    {
        for (int j = 0; j < B[0].size(); ++j)
        {
            for (int k = 0; k < B.size(); ++k)
                ret[i][j] = ret[i][j] + A[i][k] * B[k][j];
        }
    }
    return ret;
}
mat power(mat A, int n)
{
    mat ret(A.size(), vector<mint>(A.size()));
    for (int i = 0;  i < A.size(); ++i)
        ret[i][i] = 1;
    for (; n; A = A * A, n >>= 1)
    {
        if (n & 1) ret = ret * A;
    }
    return ret;
}
signed main()
{
    cin.tie(0)->sync_with_stdio(false);
    cin>>n>>m>>k;
    M.resize(n, vector<mint>(n));

    mat A(1, vector<mint>(n));
    for (int i = 0; i< n;++i)
        cin>>A[0][i].n;

    for (int i = 0; i<m;++i)
    {
        int u, v; cin>>u>>v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    init_fact();

    for (int i = 0; i < n;++i)
    {
        M[i][i] = mint(1) - mint(g[i].size()) / m / 2;
        for (int it: g[i])
        {
            M[it][i] = mint(1) / m / 2;

        }
    }

    mat Ans = A * power(M, k);
    for (int i = 0; i<n;++i)
        cout << Ans[0][i].n << '\n';
    return 0;
}

#include<bits/stdc++.h>
#define LL long long
#define rint register int
#define LB lower_bound
#define UB upper_bound
#define MS(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(rint i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(rint i=a,i##end=b;i>=i##end;--i)
#define cms printf("%.2lf\n",(&o2-&o1)/1024.0/1024);
using namespace std;bool o1;
char IO;
inline int Rd(){
	int _s_=0;bool _f_=0;
	while(!isdigit(IO=getchar()))
		(IO=='-')&&(_f_=1);
	do _s_=(_s_<<1)+(_s_<<3)+(IO^48);
	while(isdigit(IO=getchar()));
	return _f_?-_s_:_s_;
}
const int P=1e9+7,n2=5e8+4;
int n,m,k,n2m,a1,b1,in[104];
void cmod(int &x){
	x>=P&&(x-=P);
}
int ksm(int x){
	int rst=1;
	for(rint y=P-2;y;y>>=1,x=1ll*x*x%P)
		(y&1)&&(rst=1ll*rst*x%P);
	return rst;
}
struct node{
	int a[105][105];
	node(){MS(a,0);}
	node operator * (const node &_) const{
		node rst;
		rep(i,1,n)
			rep(j,1,n)
				rep(l,1,n)
					cmod(rst.a[i][j]+=1ll*a[i][l]*_.a[l][j]%P);
		return rst;
	}
}st,nw;
bool o2;int main(){
	n=Rd(),m=Rd(),k=Rd();
	n2m=1ll*ksm(m)*n2%P;
	rep(i,1,n)
		st.a[1][i]=Rd();
	rep(i,1,m){
		in[a1=Rd()]++,in[b1=Rd()]++;
		nw.a[a1][b1]=nw.a[b1][a1]=n2m;
	}
	rep(i,1,n)
		cmod(nw.a[i][i]=P+1-1ll*in[i]*n2m%P);
	rep(i,0,29){
		if(k&(1<<i))
			st=st*nw;
		nw=nw*nw;
	}
	rep(i,1,n)
		printf("%d\n",st.a[1][i]);
	return 0;
}


#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int n; cin >> n;
    if (n % 2 == 0) cout << "White" << endl;
    else cout << "Black" << endl;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
     cout<<n-1<<endl;
}


#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}
void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}
void ioinit() { cout << fixed << setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

struct edge {
    int v;
    ll cost;
};
struct edg2 {
    int v;
    ll c;
    ll d;
};
class greater_cost {
   public:
    bool operator()(const edge& lh, const edge& rh) const {
        return lh.cost > rh.cost;
    }
};
using pq_mincost = priority_queue<edge, vector<edge>, greater_cost>;

const ll LG = 1e17;
vector<vector<edge>> edgcost;
vector<vector<edg2>> edgs;
vector<ll> c;
vector<ll> d;
ll dijkstra() {
    ll n = edgs.size();
    vector<bool> done(n, false);
    pq_mincost pq;
    pq.push({0, 0});
    while (!pq.empty()) {
        edge e = pq.top();
        pq.pop();
        ll cost = e.cost;
        int u = e.v;
        if (done[u]) continue;
        done[u] = true;

        if (u == n - 1) {
            return cost;
        }
        for (auto v : edgs[u]) {
            ll left = cost;
            ll right = LG;
            while (right - left >= 3) {
                ll t1 = left + (right - left) / 3;
                ll t2 = left + 2 * (right - left) / 3;
                double x1 = t1 + v.c + double(v.d) / (t1 + 1);
                double x2 = t2 + v.c + double(v.d) / (t2 + 1);

                if (x1 <= x2) {
                    right = t2;
                } else {
                    left = t1;
                }
            }
            ll nc = INF;
            for (ll t = max(left - 2, cost); t <= right + 2; t++) {
                ll x = t + v.c + v.d / (t + 1);
                nc = min(nc, x);
            }
            pq.push({v.v, nc});
        }
    }
    return -1;
}
int main() {
    // ダイクストラで三分探索(!?)
    ioinit();
    ll n, m;
    cin >> n >> m;
    edgcost.resize(n);
    edgs.resize(n);
    c.resize(m);
    d.resize(m);
    for (ll i = 0; i < m; i++) {
        ll a, b;
        cin >> a >> b >> c[i] >> d[i];
        a--;
        b--;
        edgs[a].push_back({int(b), c[i], d[i]});
        edgs[b].push_back({int(a), c[i], d[i]});
    }
    ll ans = dijkstra();
    print(ans);
}

#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll 				long long int
#define ld				long double
#define mod             1000000007
#define inf             1e18
#define endl			"\n"
#define pb 				push_back
#define vi              vector<int>
#define vl              vector<ll>
#define vs				vector<string>
#define pii             pair<ll,ll>
#define ump				unordered_map
#define mp 				make_pair
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define all(n) 			n.begin(),n.end()
#define ff 				first
#define ss 				second
#define mid(l,r)        (l+(r-l)/2)
#define bitc(n) 		__builtin_popcount(n)
#define loop(i,a,b) 	for(int i=(a);i<=(b);i++)
#define looprev(i,a,b) 	for(int i=(a);i>=(b);i--)
#define iter(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define log(args...) 	{ string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define logarr(arr,a,b)	for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
#define M 		1000000007
#define w(x)            int x; cin>>x; while(x--)
template <typename T> T gcd(T a, T b) {if (a % b) return gcd(b, a % b); return b;}
template <typename T> T lcm(T a, T b) {return (a * (b / gcd(a, b)));}
vs tokenizer(string str, char ch) {std::istringstream var((str)); vs v; string t; while (getline((var), t, (ch))) {v.pb(t);} return v;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pbtrie;

void file_i_o()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

const int N = 2e5 + 5;

vi v(N);

class union_find
{

public:
	int *pr;
	int *sz;

	union_find(int n)
	{
		pr = new int[n + 1];
		sz = new int[n + 1];

		for (int i = 1; i <= n; ++i)
			pr[i] = i, sz[i] = 1;
	}

	int root(int i)
	{
		if (pr[i] == i)
			return i;

		return pr[i] = root(pr[pr[i]]);
	}

	int find(int i, int j)
	{
		return (root(i) == root(j));
	}

	int un(int i, int j)
	{
		int u = root(i);
		int v = root(j);

		if (u == v)
			return 0;

		if (sz[u] < sz[v])
			swap(u, v);

		pr[v] = u;
		sz[u] += sz[v];

		return 1;
	}
};

int main(int argc, char const *argv[]) {
	clock_t begin = clock();
	file_i_o();
	// Write your code here....
	int n;
	cin >> n;

	vi v(n);

	loop(i, 0, n - 1)cin >> v[i];

	union_find dsu(N);

	int s = 0, l = n - 1;
	int ans = 0;
	while (s < l) {

		int curr = dsu.un(v[s], v[l]);

		if (curr)ans++;

		s++;
		l--;

	}

	cout << ans << endl;

#ifndef ONLINE_JUDGE
	clock_t end = clock();
	cout << "\n\nExecuted In: " << double(end - begin) / CLOCKS_PER_SEC * 1000 << " ms";
#endif
	return 0;
}


// I SELL YOU...!
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>; using PD = pair<double,ll>;
using TP = tuple<double,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll n = 30;
double dist[n][n][4];
double cnt[n][n][4];
ll dx[] = {1,0,-1,0};
ll dy[] = {0,1,0,-1};
vector<ll> dijcstra(ll sx,ll sy,ll gx,ll gy, ll ADDR) {
  const ll INF = 1e15;
  vector<vector<double>> d(n,vector<double>(n, INF));
  vector<vector<P>> pr(n,vector<P>(n, P(-1,-1)));
  priority_queue<TP,vector<TP>,greater<TP>> que;
  d[sx][sy] = 0;
  que.push(TP(0,sx,sy));
  while(!que.empty()){
    auto [di, x, y] = que.top(); que.pop();
    if(di > d[x][y]) continue;
    for(int i=0;i<4;i++){
      ll nx = x + dx[i];
      ll ny = y + dy[i];
      if(nx<0||ny<0||nx>=n||ny>=n) continue;
      if(d[x][y]+dist[x][y][i]+ADDR<d[nx][ny]) {
        d[nx][ny] = d[x][y] + dist[x][y][i] + ADDR;
        pr[nx][ny] = P(x,y);
        que.push(TP(d[nx][ny],nx, ny));
      }
    }
  }
  vector<ll> res;
  while(true){
    auto [prx, pry] = pr[gx][gy];
    if(prx==-1) {
      break;
    }
    ll x = gx-prx;
    ll y = gy-pry;
    if(x==1&&y==0) res.push_back(0);
    if(x==0&&y==1) res.push_back(1);
    if(x==-1&&y==0) res.push_back(2);
    if(x==0&&y==-1) res.push_back(3);
    gx = prx;
    gy = pry;
  }
  reverse(res.begin(),res.end());
  return res;
}
signed main(){
  double alpha = 0.7;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<4;k++){
        dist[i][j][k] = 5000;
        cnt[i][j][k] = 1;
      }
    }
  }
  for(int t=0;t<1000;t++){
    ll sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    ll addr = max(0, 10000 - t*10);
    auto route = dijcstra(sx,sy,gx,gy, addr);
    for(auto i: route) {
      if(i==0) cout << 'D';
      if(i==1) cout << 'R';
      if(i==2) cout << 'U';
      if(i==3) cout << 'L';
    }
    cout << endl;
    double result;
    cin >> result;
    result /= route.size();
    ll x = sx, y = sy;
    for(auto i:route){
      ll nx = x + dx[i];
      ll ny = y + dy[i];
      ll j = (i+2)%4;
      dist[x][y][i] = dist[x][y][i] + ((1/cnt[x][y][i]) * (result - dist[x][y][i]));
      dist[nx][ny][j] = dist[nx][ny][j] + ((1/cnt[nx][ny][j]) * (result - dist[nx][ny][j]));
      cnt[x][y][i]++;
      cnt[nx][ny][j]++;
      x = nx;
      y = ny;
    }
  }
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(a) -- no. of elements strictly less than a
// s.find_by_order(i) -- itertor to ith element (0 indexed)
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef NOOBxCODER
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else
    #define NOOBxCODER 0
    #endif
    //cin>>t;
    t=1;
    while(t--){
        cin>>k;
        cin>>n>>m;
        ll a[k];
        fo(i,k)cin>>a[i];
        ll sum=0;
        pll p[k];
        fo(i,k){
            p[i]= mp((m*a[i])%n , i);
            sum+= (m*a[i])%n;
        }
        //cout<<sum<<endl;
        sort(p,p+k);
        ll val = sum/n;
        //cout<<val;
        ll ans[k];
        fo(i, k){
            ll  j = p[i].se;
            //cout<<j<<endl;
            //cout<<a[j]<<endl;
            if(i<k-val)ans[j]= m*a[j]/n;
            else ans[j] =m*a[j]/n   + 1;
        }
        fo(i,k)cout<<ans[i]<<" ";

    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int res=0;
	bool zf=0;
	char c;
	while(((c=getchar())<'0'||c>'9')&&c!='-');
	if(c=='-')zf=1;
	else res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
	if(zf)return -res;
	return res;
}
int mu[1000005];
bool vis[1000005];
int prime[1000005],p;
inline int f(int a,int b,int d=1){
	if(!a||!b){
		return 0;
	}
	int n=a/d,m=b/d,t=min(n,m),ans=0;
	for(register int l=1,r;l<=t;l=r+1){
		r=min(t,min(n/(n/l),m/(m/l)));
		ans+=(n/l)*(m/l)*(mu[r]-mu[l-1]);
	}
	return ans;
}
signed main(){
	vis[1]=1;mu[1]=1;
	for(register int i=2;i<=1000000;i++){
		if(!vis[i]){prime[++p]=i;vis[i]=1;mu[i]=-1;}
		for(register int j=1;j<=p;j++){
			if(prime[j]*i>1000000)break;
			vis[prime[j]*i]=1;
			mu[prime[j]*i]=(i%prime[j]?-mu[i]:0);
			if(!(i%prime[j]))break;
		}
		mu[i]+=mu[i-1];
	}
	int l=read(),r=read(),A=0;
	for(register int i=2;i<=r;++i){
		int a=l/i-3;
		while(a==1||a*i<l){
			++a;
		}
		int b=r/i+3;
		while(b*i>r){
			--b;
		}
		A+=f(b,b)-f(a-1,b)-f(b,a-1)+f(a-1,a-1);
	}
	printf("%lld\n",A);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define nline "\n"
const ll M1=1e9+7;
const ll M2=998244353;
const ll N=1000005;
const ll INF_MUL=1e13;
const ll INF_ADD=1e18;
#define f first
#define s second
#define pll pair<ll,ll>
#ifndef ONLINE_JUDGE
#define debug(x) cerr<<#x<<" "; _print(x); cerr<<nline;
#else
#define debug(x);
#endif
void _print(ll x){cerr<<x;}
template<class T,class V> void _print(pair<T,V> p) {cerr<<"{"; _print(p.first);cerr<<","; _print(p.second);cerr<<"}";}
template<class T>void _print(vector<T> v) {cerr<<" [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T>void _print(set<T> v) {cerr<<" [ "; for (T i:v){_print(i); cerr<<" ";}cerr<<"]";}
template<class T>void _print(multiset<T> v) {cerr<< " [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T,class V>void _print(map<T, V> v) {cerr<<" [ "; for(auto i:v) {_print(i);cerr<<" ";} cerr<<"]";}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

void solve(){
    ll l,r,final=0; cin>>l>>r;
    vector<ll> ans(r+5,0),bad(r+5,0);
    for(ll i=r-1;i>=2;i--){
        ans[i]=r/i-(l-1)/i-(i>=l);
        bad[i]=r/i-(l-1)/i;
        bad[i]=bad[i]*(bad[i]-1);
        ans[i]=ans[i]*(ans[i]-1);
        for(ll j=i+i;j<=r;j+=i){
            ans[i]-=bad[j];
            bad[i]-=bad[j];
        }
        final+=ans[i];
    }
    cout<<final;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    ll test_cases=1;
    //cin>>test_cases;
    while(test_cases--){
        solve();
    }
    /*
    Correct data type?
    Infinity?
    Base case?
    */
    cerr<<"Time:"<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
}


//بسم الله الرحمن الرحيم

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
//using u128 = __uint128_t;
#define el << '\n'
#define sz(v) ((int)(v).size())
#define PI 3.141592653589793238
#define _test_ int _ ; cin >> _ ; while( _-- )
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define pb push_back
ll gcd ( ll  a, ll b ) { return __gcd ( a, b );}
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) );}
ll big_mod(ll base , ll power , ll mod){
    ll ret=1;base%=mod;while(power){if(power&1)ret=ret*base%mod;base=base*base%mod;power>>=1;}return ret;}
ll mod_inverse(ll a , ll mod ){ return big_mod(a,mod-2,mod);}
ull POW(ll a , ll b){if(b==0) return 1;ull ret=1;while(b--)ret*=a;return ret;}
int dx[]={0,0,+1,-1,+1,-1,-1,+1};
int dy[]={+1,-1,0,0,+1,-1,+1,-1};
// ------------------>
const ll infLL = 15e17+123;
const int inf = 1e9+7;
const ll mod = 1e9+7;
const ll mx = 1e5+123;
// ------------------>

void _case_()
{
    int v,t,s,d;
    cin >> v >> t >> s >> d;
    int a=v*t ;
    int b=v*s;
    if(d<a or d>b) cout << "Yes\n";
    else cout << "No\n";
}

int main()
{
    optimize();
    //_test_
        _case_();
    return 0;//                                                          AUTHOR : NAYEMUR RAHMAN NAYEM
}//                                                                      [ DEPT. of CSE ; CU ; ( 19 th Batch ) ]

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

int main() {
  int V,T,S,D;
  cin>>V>>T>>S>>D;

  if(V*T<=D && D<=V*S){
    cout<<"No";
  }
  else{
    cout<<"Yes";
  }

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define INF 0x3f3f3f3f
#define pi M_PI
typedef pair<ll, ll> llPair;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef priority_queue<ll> pqll;
ll MOD = 1000000007;
/*
Really doe, like really doe
Really doe, like really doe
*/
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    t = 1;
    for (ll z = 0; z < t; ++z)
    {
        ll h, w;
        cin >> h >> w;
        vector<vb> block(h, vb(w, false));
        vector<vll> dp(h, vll(w, 0));
        vector<vll> dig(h + 1, vll(w + 1, 0));
        vector<vll> hor(h + 1, vll(w + 1, 0));
        vector<vll> ver(h + 1, vll(w + 1, 0));
        for (ll i = 0; i < h; ++i)
        {
            for (ll j = 0; j < w; ++j)
            {
                char c;
                cin >> c;
                if (c == '#')
                {
                    block[i][j] = true;
                }
            }
        }
        dp[0][0] = 1;
        dig[1][1] = 1;
        hor[1][1] = 1;
        ver[1][1] = 1;
        for (ll i = 0; i < h; ++i)
        {
            for (ll j = 0; j < w; ++j)
            {
                if (i == 0 && j == 0)continue;
                else if (block[i][j])
                {
                    dp[i][j] = 0;
                    dig[i][j] = 0;
                    hor[i][j] = 0;
                    ver[i][j] = 0;
                }
                else
                {
                    dp[i][j] = hor[i][j + 1] + ver[i + 1][j] + dig[i][j];
                    dp[i][j] %= MOD;
                    hor[i + 1][j + 1] = (hor[i][j + 1] + dp[i][j]) % MOD;
                    dig[i + 1][j + 1] = (dig[i][j] + dp[i][j]) % MOD;
                    ver[i + 1][j + 1] = (ver[i + 1][j] + dp[i][j]) % MOD;
                }
            }
        }
        cout << dp[h - 1][w - 1] << '\n';
    }

    return 0;
}

// time-limit: 2000
#include<bits/stdc++.h>
using namespace std;

#define int long long
const int inf = 1e9 + 7;

void solve(){
    int n;
    cin >> n;
    vector<int> xi(n+1), yi(n+1);
    for(int i=1; i<=n; i++){
        cin >> xi[i] >> yi[i];
    }
    int m;
    cin >> m;
    typedef array<int, 3> arr;

    // 0:x, 1:y, 2:c
    vector<arr> X(m+1), Y(m+1);
    X[0][0] = 1;
    Y[0][1] = 1;
    X[0][1] = X[0][2] = Y[0][0] = Y[0][2] = 0;
    auto neg = [&](arr a){
        for(int i=0; i<3; i++){
            a[i] *= -1;
        }
        return a;
    };
    for(int i=1; i<=m; i++){
        int op;
        cin >> op;
        if(op == 1){
            X[i] = Y[i-1];
            Y[i] = neg(X[i-1]);
        } else if(op == 2){
            X[i] = neg(Y[i-1]);
            Y[i] = X[i-1];
        } else if(op == 3){
            int p;
            cin >> p;
            X[i] = neg(X[i-1]);
            X[i][2] += 2 * p;
            Y[i] = Y[i-1];
        } else{
            int p;
            cin >> p;
            X[i] = X[i-1];
            Y[i] = neg(Y[i-1]);
            Y[i][2] += 2 * p;
        }
    }

    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        int point, after;
        cin >> after >> point;
        cout << X[after][0]*xi[point] + X[after][1]*yi[point] + X[after][2] << ' ';
        cout << Y[after][0]*xi[point] + Y[after][1]*yi[point] + Y[after][2] << '\n';
    }
}

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

    int T = 1, t = 0;
    while(t++ < T){
        //cout << "Case #" << t << ": ";
        solve();
    }

    return 0;
}


#include<bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef long double f128;
using namespace std;

template<typename T>
void scan(T& n){
  cin>>n;
}

template<typename T,typename U>
void scan(pair<T,U>& p){
  cin>>p.first>>p.second;
}

void scan(){}

template<typename T,class... Args>
void scan(T& n,Args&... args){
  scan(n);
  scan(args...);
}

template<typename T>
void scanall(T start,T end){
  for(;start!=end;++start){
    scan(*start);
  }
}

template<typename T>
void print(T n){
  cout<<n;
}

template<typename T,typename U>
void print(pair<T,U> p){
  cout<<'{'<<p.first<<','<<p.second<<'}';
}

void print(){}

template<typename T,class... Args>
void print(T n,Args... args){
  print(n);
  print(args...);
}

template<typename T>
void println(T n){
  print(n);
  cout<<endl;
}

template<typename T,class... Args>
void println(T n,Args... args){
  print(n,' ');
  println(args...);
}

template<typename T>
void printall(T start,T end){
  if(start!=end){
    print(*start);
    for(++start;start!=end;++start){
      print(' ',*start);
    }
  }
  cout<<endl;
}

template<typename T>
T chmax(T& n,T m){
  return n=max(n,m);
}

template<typename T>
T chmin(T& n,T m){
  return n=min(n,m);
}

template<typename T,typename U>
T power(T a,U n){
  T res=1;
  while(n){
    res*=(n&1)?a:1;
    a*=a;
    n>>=1;
  }
  return res;
}

template<typename T>
struct combination{
  vector<T> fact;
  combination(const int Max):fact(Max+1,1){
    for(int i=2;i<=Max;++i){
      fact[i]=fact[i-1]*(T)i;
    }
  }
  template<typename U>
  T nCk(U n,U k){
    if(n<k||n<0||k<0){
      return 0;
    }
    return fact[n]/fact[k]/fact[n-k];
  }
};

void solve();

int main(){
  cout<<fixed<<setprecision(15);
  bool is_multitestcase=0;
  int T=1;
  if(is_multitestcase){
    scan(T);
  }
  for(int i=0;i<T;++i){
    solve();
  }
  return 0;
}

void solve(){
  f128 A,B;
  scan(A,B);
  println(A*B/100);
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf (ll)1e18
#define mod 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
const ll N=1000001 ;
int main()
{
	fast ;
	ll n,m ; cin>>n>>m ;
	vector<ll>v(m+2) ;
	for(ll i=1;i<=m;i++) cin>>v[i] ;

	v[0]=0 ;
	v[m+1]=n+1 ;

	sort(all(v)) ;

	ll mn=n,ans=0;
	for(ll i=1;i<=m+1;i++)
	{
		if(v[i]-v[i-1]>1)
		{
			mn=min(mn,v[i]-v[i-1]-1) ;
		}
	}

	for(ll i=1;i<=m+1;i++)
	{
		if(v[i]-v[i-1]>1)
		{
			ans+=(v[i]-v[i-1]-1+mn-1)/mn ;
		}

	}
	cout<<ans<<endl ;

}


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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    for ( int i = 1; i < N; i++ ) {
        cin >> P[i];
        P[i]--;
    }
    P[0] = -1;
    vector<vector<int>> G(N); // ch
    for ( int i = 1; i < N; i++ ) {
        G[P[i]].push_back(i);
    }

    vector<int> pt(N), sb(N,1);
    auto dfs = [&](auto self, int v) -> void {
        vector<vector<int>> val(2); // [even/odd] 選択したときに得るコインの差分
        for ( int u : G[v] ) {
            self(self, u);
            sb[v] += sb[u];
            val[sb[u]%2].push_back(pt[u]);
        }
        int s = -1;
        for ( int a : val[0] ) {
            if ( a > 0 ) s += a;
        }
        sort(val[1].rbegin(), val[1].rend());
        int odd = 1;
        for ( int a : val[1] ) {
            s += a * odd;
            odd *= -1;
        }
        for ( int a : val[0] ) {
            if ( a < 0 ) s += a * odd;
        }
        pt[v] = s;
    };
    dfs(dfs,0);

    ll ans = (N-pt[0])/2;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> vec(n);
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      cin >> vec[i];
    }
    else {
      ll tmp;
      cin >> tmp;
      vec[i] = vec[i-1] + tmp;
    }
  }

  ll cur = 0;
  ll ans = 0;
  ll vmax = vec[0];
  for (auto &v : vec) {
    vmax = max(v, vmax);
    ans = max(ans, cur + vmax);
    cur += v;
  }

  cout << ans << endl;
}


// E - White Pawn
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N, M; cin>>N>>M;
	int C = min(N, M), L = C*2 + 1;

	auto ixOk = [&](int y){ return 0 <= y && y < L; };

	vector<pair<int,int>> D;
	while(M--){
		int x, y; cin>>x>>y;
		y -= N - C;
		if(ixOk(y)) D.emplace_back(x, y);
	}
	sort(D.begin(), D.end());

	vector<int> Y, S(L); S[C] = 1;

	auto update = [&](){
		vector<int> A;
		for(int&y:Y)
			if((ixOk(y-1) && S[y-1]) || (ixOk(y+1) && S[y+1])) A.push_back(y);
		for(int&y:Y) S[y] = 0;
		for(int&y:A) S[y] = 1;
	};

	int px = 0;
	for(auto&[x, y]:D){
		if(px != x) update(), Y.clear(), px = x;
		Y.push_back(y);
	}
	update();
	cout<< accumulate(S.begin(), S.end(), 0) <<endl;
}

#include <bits/stdc++.h>

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int N = 2e5+5;
int bit[N], row[N], col[N];
vector<int> tt[N];

void update(int pos, int val){
	while(pos < N){
		bit[pos] += val;
		pos += pos&-pos;
	}
}

int query(int pos){
	int res = 0;
	while(pos){
		res += bit[pos];
		pos -= pos&-pos;
	}
	return res;
}

signed main(){
	fastio
	int h,w,m;
	cin >> h >> w >> m;
	fill(row,row+N,w);
	fill(col,col+N,h);
	while(m--){
		int x,y;
		cin >> x >> y;
		x--,y--;
		row[x] = min(row[x],y);
		col[y] = min(col[y],x);
		tt[y].push_back(x);
	}
	int ans = 0;
	int i;
	for(i = 0;i < h&&row[i];i++) ans += row[i];
	int ok[h];
	fill(ok,ok+h,1);
	for(;i < h;i++) ok[i] = 0, update(i,1);
	for(i = 0;i < w&&col[i];i++){
		for(int j : tt[i]){
			if(ok[j]) ok[j] = 0, update(j,1);
		}
		ans += query(col[i]-1);
	}
	cout << ans << "\n";
}

/*
	*	*	*	*
	*	*	X	*
	*	X	*	X
	*	*	*	*
*/


#include <bits/stdc++.h>
#define spd ios::sync_with_stdio(false),cin.tie(0)
using namespace std;
using ll = long long;

#define N 1000005
#define MAX 1e18

vector<ll> powers;
set<ll> squares;
set<ll> s;

void powersPrecomputation()
{
    for (ll i = 2; i < N; i++) {
        squares.insert(i * i);
        if (squares.find(i) != squares.end()) continue;
        ll temp = i;
        while (i * i <= MAX / temp) {
            temp *= (i * i);
            s.insert(temp);
        }
    }
    for (auto x : s) powers.push_back(x);
}

ll calculateAnswer(ll L, ll R)
{
    ll perfectSquares = floor(sqrtl(R)) - floor(sqrtl(L - 1));
    ll high = (upper_bound(powers.begin(), powers.end(), R) - powers.begin());
    ll low = (lower_bound(powers.begin(), powers.end(), L) - powers.begin());
    perfectSquares += (high - low);
    return perfectSquares;
}

int main()
{
    powersPrecomputation();
    ll L = 1;
    ll R; cin >> R;
    cout << R - calculateAnswer(L, R) + 1 << endl;
    return 0;
}

#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define RREP_(i, a_, b_, a, b, ...) for (Int i = Int(b) - 1, low##i = (a); i >= low##i; i--)
#define RREP(i, ...) RREP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on
struct in {
    template <class T> operator T() {
        T t;
        std::cin >> t;
        return t;
    }
};
void out() { std::cout << "\n"; }
template <class Head, class... Tail> void out(Head&& h, Tail&&... t) {
    std::cout << h << (sizeof...(Tail) == 0 ? "" : " "), out(std::forward<Tail>(t)...);
}
template <class T> bool chmin(T& a, const T& b) { return a > b ? a = b, true : false; }
template <class T> bool chmax(T& a, const T& b) { return a < b ? a = b, true : false; }
template <class T> using V = std::vector<T>;

/**
 *    author:  knshnb
 *    created: Sun Feb 28 00:29:14 JST 2021
 **/

V<V<Int>> solve(Int n) {
    V<V<Int>> ret(1);
    REP(i, 1 << n) ret[0].push_back(i < (1 << (n - 1)));
    if (n == 1) return ret;
    auto sub = solve(n - 1);
    REP(t, 2) {
        for (auto& v : sub) {
            ret.push_back({});
            for (Int x : v) ret.back().push_back(x);
            for (Int x : v) ret.back().push_back(t ? !x : x);
        }
    }
    return ret;
}
signed main() {
    Int n = in();
    auto res = solve(n);
    out(res.size());
    for (auto& v : res) {
        for (Int x : v) std::cout << char('A' + x);
        out();
    }
}


#include<iostream>
#include<vector>
using namespace std;
const int BUF = 100005;
const int BIT = 25;

int N, M;
int val[BUF];

void read() {
    cin >> N >> M;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        val[i] = 0;
        for (int j = 0; j < M; ++j) {
            val[i] <<= 1;
            val[i] += s[j] - '0';
        }
    }
}

void work() {
    int cnt[BIT] = {};
    for (int i = 0; i < N; ++i) {
        ++cnt[__builtin_popcount(val[i])];
    }

    long long ans = 0;
    for (int i = 0; i < BIT; ++i) {
        for (int j = i + 1; j < BIT; ++j) {
            if (abs(i - j) % 2 == 1) {
                ans += 1LL * cnt[i] * cnt[j];

            }
        }
    }
    cout <<  ans << endl;
}

int main() {
    read();
    work();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
template<class T> using V = vector<T>;
template<typename T> using posteriority_queue = priority_queue<T,vector<T>,greater<T>>;
#define rep(i,n) for (int i = 0; i < (int)(n) ; i++)
#define rep2(i,a,b) for (int i = (a); i < (int)(b); i++)
#define repR(i,n) for (int i = (int)(n)-1; i >= 0; i--)
#define repR2(i,a,b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ENDL '\n'
#define pb push_back
#define SIZE(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define UNIQUE(a) a.erase(unique(all(a)),a.end());
#define debug(x) cout<<(#x)<<" is : "<<(x)<<endl;
#define debugc(vec) {cout<<(#vec)<<" is below; -------"<<endl;for(auto elements:(vec))cout<<elements<<" ";cout<<endl<<"------------------"<<endl;}
inline string rev(string s) {string t(s.rbegin(), s.rend()); return t;}
template<class T> inline bool chmin(T &a, T b) { if(a>b) {a=b; return 1;} return 0;}
template<class T> inline bool chmax(T &a, T b) { if(a<b) {a=b; return 1;} return 0;}
const ll INF = (1LL<<30)-1;
const ll INFLL = (1LL<<62)-1;
const ld PI = 3.14159265358979323846L;

const ll MOD = 998244353;

ll modpow(ll x,ll y,ll mod) { //繰り返し二乗法
    if(mod==1) return 1;//特殊処理
    if(y==0) return 1;
    if(y==1) return x%mod;
    if(y%2==1) return x*modpow(x,y-1,mod)%mod;
    ll rt = modpow(x,y/2,mod);
    return rt*rt%mod;
}

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

    ll n, cnt=0; cin>>n;
    V<ll> edge(n), seen(n);
    rep(i, n) {
        cin>>edge[i];
        edge[i]--;
    }
    rep(i, n) {
        if(seen[i]) continue;
        seen[i]=i+1;
        ll now = i;
        while(1) {
            ll to = edge[now];
            if(seen[to]) {
                if(seen[to]==i+1) cnt++;
                break;
            }
            seen[to]=i+1;
            now = to;
        }
    }
    cout << modpow(2,cnt,MOD)-1 << endl;
}

#include<bits/stdc++.h>
using namespace std;
vector<int>f(200009),sz(200009,0);
inline int getf(int x) {
	if(x!=f[x]) return f[x]=getf(f[x]);
	else return x;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	long long ans=0;
	cin>>n;
	vector<int>a(n);
	for(int i=1;i<=200008;i++) f[i]=i;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n/2;i++)
		f[getf(a[i])]=getf(a[n-i-1]);
	for(int i=1;i<=200008;i++)
		sz[getf(i)]++;
	for(int i=1;i<=200008;i++)
		if(i==getf(i))
			ans+=sz[i]-1;
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define ll long long int
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
const ll MOD=1e9+7;
const ll INF = (1LL << 60) - 1;

ll power(ll x, ll y){
	if (y == 0)
		return 1;
	ll temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return (x * temp) * temp;
}

int main(){
	int t;
	cin>>t;
	ll count1=0;
	vector <pair<int,int>> v;
	while(t--){
        int x,y;
        cin>>x>>y;
        v.pb({x,y});
	}
	for(int i=0;i<v.size()-1;i++){
        for(int j=i+1;j<v.size();j++){
//            cout<<(float)(v[j].ss-v[i].ss)/(v[j].ff-v[i].ff)<<" ";
            if((float)(v[j].ss-v[i].ss)/(v[j].ff-v[i].ff)>=-1 && (float)(v[j].ss-v[i].ss)/(v[j].ff-v[i].ff)<=1)  count1++;
        }
	}

	cout<<count1;
	return 0;
}

//#include<cstdio>
//#include<cassert>
//#include<iostream>
//#include<cstring>
//#include<algorithm>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)2e9 + 5)
#define MAXP ((int)1e5 + 5)
#define MAXL ((ll)1e18 + 5)
#define MAX_X ((int)2001)
#define MAX_Y ((int)2001)
#define pi acos(-1)
#define MOD ((int)1e9 + 7)
//#define MOD ((int)998244353 + 0)
#define BAS ((int)1e6 + 3)
//#define BAS ((int)2e5 + 3)
#define N ((int)1e5 + 9)
#define eps (1e-8)
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
#define logn 17
#define endl "\n"
#define mpp make_pair
#define BUCK 105
#define LEF (idx<<1)
#define RIG ((idx<<1)|1)
//#define int ll

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;

/*fast io
ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/

typedef tree < int,  null_type,  less < int >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;
typedef tree < pair < int, int >,  null_type,  less < pair < int, int > >,  rb_tree_tag,  tree_order_statistics_node_update > o_setp;
/// o_set s;
/// s.order_of_key(k) : Number of items strictly smaller than k .
/// *(s.find_by_order(k)) : K-th element in a set (counting from zero).

typedef long double ldd;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int my_rand(int l, int r)
{
    return uniform_int_distribution<int>(l,r) (rng);
}

int arr[N];

ll pre[N];

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

    for(int i = 1 ; i<=n ; i++){
        cin>>arr[i];
        arr[i] += arr[i];
    }
    sort(arr+1,arr+n+1);
    for(int i = 1 ; i<=n ; i++) pre[i] = pre[i-1] + arr[i];
    ll ans = MAXL;
    for(int i = 1 ; i<=n ; i++){
        ll sum = 1LL*(i-1)*arr[i]/2 + (pre[n] - pre[i-1]) - 1LL*(n-i+1)*arr[i]/2;
        ans = min(ans , sum);
    }
    cout<<fixed<<setprecision(20);
    cout<<ans/(2.0*n)<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

void solve(long long N) {
  ll x = 999'999'999'999'999;
  ll ans = 0;
  while (x > 0) {
    if (N > x) {
      ans += N - x;
    }
    x /= 1000;
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int V, E;
const int MAX_V = 2e5 + 5;
using DD = int; //ll;
#define INF 1e9+7
DD d[MAX_V];
struct edge {int to; DD cost; };
vector<edge> G[MAX_V];

int pprev[MAX_V];

void add_edge(int from, int to, DD dist) {
    G[from].push_back((edge){to, dist});
    G[to].push_back((edge){from, dist});
}
void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    fill(pprev, pprev + V, -1);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first)continue;
        for (int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if (d[e.to] >  d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
                pprev[e.to] = v;
            }
        }
    }
}

const int MAX_N = 17;

//int n;
int dd[MAX_N][MAX_N];
int dp[1 << MAX_N][MAX_N];
int N, M, K;

int rec(int S, int v, int dep){
    if (dp[S][v] >= 0) {
        return dp[S][v];
    }
    if (S == (1 << K) - 1){
        return dp[S][v] = 0;
    }
    int res = INF;
    for (int u = 0; u < K; u++) {
        if (!(S >> u & 1)) {
            res = min(res, rec(S | 1 << u, u, dep + 1) + dd[v][u]);
        }
    }
    return dp[S][v] = res;
}
int C[100005];
int main() {
    cin >> N >> M;
    V = N, E = M;
    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--; b--;
        add_edge(a, b, 1);
    }
    cin >> K;
    rep(i, K){
        cin >> C[i];
        C[i]--;
    }

    rep(i, K)rep(j, K){
        dd[i][j] = INF;
        if (i > j){

            int s = C[i], g = C[j];

            dijkstra(s);
            dd[i][j] = d[g];
            dd[j][i] = d[g];
            //fprintf(stderr, "dd[%d][%d] = %d\n", C[i] + 1, C[j] + 1, dd[i][j]);
            if (d[g] == INF){
                cout << -1;
                return 0;
            }

        }
    }

    memset(dp, -1, sizeof(dp));
    int res = INF;
    for (int u = 0; u < K; u++) {
         chmin(res, rec(1 << u, u, 1));
    }
    cout << res + 1;
}

#include <bits/stdc++.h>

using namespace std ;

const int MAX = 18 ;

int mark[MAX][MAX] ;
int n , m ;
int can[1 << MAX] , dp[1 << MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		int a , b ;
		cin>>a>>b ;
		a-- , b-- ;
		mark[a][b] = mark[b][a] = 1 ;
	}
	can[0] = 1 ;
	for(int mask = 1 ; mask < (1 << n) ; ++mask)
	{
		int first = -1 ;
		for(int bit = 0 ; bit < n ; ++bit)
		{
			if((mask & (1 << bit)))
			{
				if(first == -1)
					can[mask] = can[mask ^ (1 << bit)] , first = bit ;
				else
					can[mask] &= mark[first][bit] ;
			}
		}
	}
	dp[0] = 0 ;
	for(int mask = 1 ; mask < (1 << n) ; ++mask)
	{
		dp[mask] = 1e9 ;
		for(int submask = mask ; submask ; submask = (submask - 1) & mask)
		{
			if(can[submask])
				dp[mask] = min(dp[mask] , 1 + dp[mask ^ submask]) ;
		}
	}
	return cout<<dp[(1 << n)-1]<<"\n" , 0 ;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int N;
int A[2020];
bool ok(int X)
{
	int g=0;
	for(int i=0;i<N;i++)
	{
		int t=gcd(g,A[i]);
		if(t%X==0)g=t;
	}
	return g==X;
}
main()
{
	cin>>N;
	vector<pair<int,int> >X;
	int mA=1e9;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		mA=min(mA,A[i]);
		for(int j=1;j*j<=A[i];j++)if(A[i]%j==0)
		{
			X.push_back(make_pair(j,i));
			if(A[i]/j>j)X.push_back(make_pair(A[i]/j,i));
		}
	}
	sort(X.begin(),X.end());
	int ans=0;
	for(int i=0;i<X.size();)
	{
		if(X[i].first>mA)break;
		int j=i+1;
		int g=A[X[i].second];
		while(j<X.size()&&X[i].first==X[j].first)
		{
			g=gcd(g,A[X[j++].second]);
		}
		if(g==X[i].first)ans++;
		i=j;
	}
	cout<<ans<<endl;
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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


#include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include <algorithm>

using namespace std;

#define mem(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define ft first
#define sd second
#define endl '\n'
#define PI acos(-1.0)
#define lcm(a,b) a/gcd(a,b)*b
#define INF_INT 0x3f3f3f3f
#define debug(a) cout<<#a<<"="<<a<<endl;
#define _for(i,a,b) for( int i=(a); i<(b); ++i)
#define _rep(i,a,b) for( int i=(a); i<=(b); ++i)

//inline void print(__int128 x){if(x<0){putchar('-');x=-x;}if(x>9) print(x/10);putchar(x%10+'0');}
int gcd(int a, int b){return b ? gcd(b, a % b) : a;}
int exgcd(int a, int b, int &x, int &y){if(!b){x = 1; y = 0;return a;}int d = exgcd(b, a % b, y, x);y -= (a/b) * x;return d;}
ll qmi(ll m, ll k, ll p){ll res = 1 % p, t = m;while (k){if (k&1) res = res * t % p;t = t * t % p;k >>= 1;}return res;}
inline int read(){int s=0,x=1;char ch=getchar();while(ch<'0'||ch>'9') {if(ch=='-') x=-1; ch=getchar();}while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar(); }return s*x;}

const int NN = 1e6+7;
const int mod = 1e9+7;

int N,M,k;

ll C(int n, int m){
    if(n<0||m<0) return 0;
    ll res = 1;

    _rep(i,1,n+m){
        res = (res*i)%mod;
    }

    _rep(i,2,m){
        ll ni = qmi(i,mod-2,mod);
        res = (res*ni) %mod;
    }
    _rep(i,2,n){
        ll ni = qmi(i,mod-2,mod);
        res = (res*ni) %mod;
    }
    return res;
}
void solve()
{
    cin >> N >> M >> k;
    if(N-k-M > 0) puts("0");
    else{
        cout << (C(N,M)-C(N-k-1,M+k+1)+mod)%mod << endl;
    }
}
int main()
{
    //ios::sync_with_stdio(0);
    int T = 1;

    while(T--)
    {
        solve();
    }
    return 0;
}

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

using namespace std;

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

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b); i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)

#define sz(x) (int)(x).size()
#define popcnt(x) __builtin_popcount(x)
#define low_bo(a, x) (lower_bound(a.begin(), a.end(), x) - a.begin())
#define up_bo(a, x) (upper_bound(a.begin(), a.end(), x) - a.begin())
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
#define shuffle(a) shuffle(a.begin(), a.end(), rnd)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 998244353;
const char nl = '\n';
const int MX = 20000; //check the limits, dummy
int n, m, np;
ull fac[MX];
ll c[5001];
ll rev(ll x, ll m) { return x == 1 ? 1 : (1 - rev(m % x, x) * (ll)m) / x + m; }
ll choose(ll n, ll r) {
	if (n < r)
		return 0;
	if (r == 0)
		return 1;
	return ((fac[n] * (rev(fac[r], MOD) % MOD)) % MOD * (rev(fac[n - r], MOD) % MOD)) % MOD;
}
void init() {
	fac[0] = 1;
	for (int i = 1; i < MX; i++)
		fac[i] = (fac[i - 1] * i) % MOD;
}
void solve(int t) {
	cin >> n >> m;
	np = (n / 2) * 2;
	if (m % 2) {
		cout << "0\n";
		return;
	}
	ll dp[5001][13];
	for (int ma = 0; ma < 5001; ma++) {
		if (ma % 2) continue;
		dp[ma][0] = choose(n, ma);
	}
	for (int d = 1; d < 13; d++) {
		for (int ma = 0; ma < 5001; ma++) {
			if (ma % 2) continue;
			int p2 = (1 << d);
			int mx = min(ma / 2 / p2, n / 2);
			ll ret = 0;
			for (int i = 0; i <= mx; i++) {
				ret = ((dp[2 * i][0] * dp[ma - i * 2 * p2][d - 1]) % MOD + ret) % MOD;
			}
			dp[ma][d] = ret;
		}
	}
	int d = 0;
	while ((1 << d) <= m)
		d++;
	cout << dp[m][d - 2] << nl;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(20);
	cout << fixed;
	init();
	int T = 1;
	F0R(i, T) {
		solve(i + 1);
	}
}

// read the question correctly (ll vs int)
// template by bqi343


#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>
#include <unordered_map>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())

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

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;
#define PI 3.14159265358979323846264338327950L

const int mod = 1000000007;

struct container{
    int bottom, top, id;
    container(int id, int bottom, int top): top(top), bottom(bottom),id(id){
    }
};

struct Data {
    int ind;
    ll time;
    Data(int ind,ll time): ind(ind),time(time){}
    bool operator<(const Data& a) const {
    return time > a.time;
    }
};

class UnionFind{
public:
    int uf[200005];

    unordered_map<int,unordered_map<int,int>> kids;

    UnionFind(vector<int>& a){
        int n = a.size();
        memset(uf,-1,sizeof uf);

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

    int parent(int i){
        if (uf[i] < 0) return i;
        return uf[i] = parent(uf[i]);
    }

    void join(int i, int j){
        int pi = parent(i);
        int pj = parent(j);
        if (pi == pj) return;
        if (size(pi) < size(pj)) swap(pi,pj);
        for(auto e: kids[pj]){
            kids[pi][e.first] += e.second;
        }
        uf[pi] += uf[pj];
        uf[pj] = pi;

    }

    int size(int i){
        int pi = parent(i);
        return abs(uf[pi]);
    }

    void init(){
        memset(uf,-1,sizeof uf);
    }
};

void solve(){
    int n,q;
    cin >> n >> q;

    vector<int> c(n);
    rep(i,n) cin >> c[i];
    UnionFind uf(c);

    rep(i,q){
        int t;
        cin >> t;
        if (t==1){
            int a,b;
            cin >> a >> b;
            uf.join(a,b);
        }
        else{
            int x,y;
            cin >> x >> y;
            int p = uf.parent(x);
            cout << uf.kids[p][y] << endl;
        }
    }

}

int main() {
    int T = 1;
    //cin >> T;

    while (T--){
        solve();
        cout << endl;
    }
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }
ll modpow(ll x, ll p, ll m) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % m; } now*=2; pm = pm*pm % m; } return result; }

int main() {
  ll A, B, C; cin >> A >> B >> C;
  ll bc = modpow(B,C,4); if (bc==0) bc = 4;
  ll abc = modpow(A,bc,10);
  cout << abc << endl;
  return 0;
}