#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(char &c){
  int i;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
char s[100000+10];
int n;
int main(){
  int i;
  n = rd(s);
  reverse(s, s+n);
  for(i=(0);i<(n);i++){
    if(s[i] == '6'){
      s[i] = '9';
    }
    else if(s[i] == '9'){
      s[i] = '6';
    }
  }
  wt_L(s);
  wt_L('\n');
  return 0;
}
// cLay version 20210405-1

// --- original code ---
// char s[1d5+10];
// int n;
// {
//     rd(s@n);
//     reverse(s, s+n);
//     rep(i, n) {if(s[i] == '6') {s[i] = '9';} else if(s[i] == '9') {s[i] = '6';}}
//     wt(s);
// }

//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

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

int n;
int arr[1005];
int brr[1005];
int apsp[1005][1005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);

	memset(apsp,1,sizeof(apsp));

	cin>>n;
	rep(x,0,n){
		arr[x]=(2*x)%n;
		brr[x]=(2*x+1)%n;
	}

	rep(x,0,n) cout<<arr[x]+1<<" "<<brr[x]+1<<endl;

}


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

long long binpow(long long a, long long b, long long MOD) {
  long long res = 1;
  while (b) {
    if (b % 2) res = res * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, m;
  cin >> n >> m;
  cout << binpow(10, n, m * m) / m << '\n';
}

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

using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();

template <typename T1, typename T2>
inline bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <std::ostream& os = std::cout>
class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        auto operator()(const Args&... args) const -> decltype((os << ... << std::declval<Args>()), void()) { print(args...); }
        template <typename T>
        auto pvec(const T& vec, size_t sz) const -> decltype(os << std::declval<decltype(std::declval<T>()[0])>(), void()) {
            for (size_t i = 0; i < sz; i++)
                os << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T>
        auto pmat(const T& mat, size_t h, size_t w) -> decltype(os << std::declval<decltype(std::declval<T>()[0][0])>(), void()) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++)
                    os << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { os << term; }
        void print_rest() const { os << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { os << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { os << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints<> prints;
Prints<std::cerr> prints_err;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, M;
    cin >> N >> M;
    ll x = 1;
    ll c = 10;
    for (; N > 0; N >>= 1) {
        if (N & 1) x = x * c % (M * M);
        c = c * c % (M * M);
    }
    prints()(x / M);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    std::ifstream ifs("./in_out/input.txt");
    std::cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    std::ofstream ofs("./in_out/output.txt");
    std::cout.rdbuf(ofs.rdbuf());
#endif
    std::cout << std::setprecision(18) << std::fixed;
    solve();
    std::cout << std::flush;
    return 0;
}


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

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 rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(int i=cc;i>=n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>

using ll = long long;

const vector<int> dx = {1, 0, -1,  0};
const vector<int> dy = {0, 1,  0, -1};

const vector<int> dx2 = {1, 1,  1, 0,  0, 0, -1, -1, -1};
const vector<int> dy2 = {1, 0, -1, 1, -1, 0,  1,  0, -1};

const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
const ll mod2 = 998244353;

const ll MAX = 1000000;
const ll MOD = 1000000007;
const ll big = (1ll<<60);

const ll moda = 1000000007;
const ll modb = 100000007;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

ll modPow(ll a, ll n, ll p) {
  if (n == 0) return 1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  ll t = modPow(a, n / 2, p);
  return (t * t) % p;
}

ll choose(ll n, ll r, ll mod){
    ll mul = 1, div = 1;
    for(ll i = 0; i < r; i++){
        mul *= n - i;
        div *= i + 1;
        mul %= mod;
        div %= mod;
    }
    return mul * modPow(div, mod - 2, mod) % mod;
}

int main(){
  int n;
  string s, x;
  cin >> n >> s >> x;
  vector<vector<bool>>dp(7,vector<bool>(n+1,false));//takahashi_win:true
  dp[0][n] = true;
  int digit = 1;
  rep(i, 0, n){
    int temp = (s[n-1-i]-'0');
    if(x[n-1-i]=='T'){
      rep(j, 0, 7){
        dp[j][n-i-1] = dp[(temp*digit+j)%7][n-i]||dp[j][n-i];
      }
    }else{
      rep(j, 0, 7){
        dp[j][n-i-1] = dp[(temp*digit+j)%7][n-i]&&dp[j][n-i];
      }
    }
    if(i!=n-1)(digit *= 10) %= 7;
  }
  /*
  if(x[0]=='T'){
    if(dp[(s[0]-'0')*digit%7][0]||dp[0][0]){
      cout << "Takahashi" << endl;
    }else{
      cout << "Aoki" << endl;
    }
  }else{
    if(dp[(s[0]-'0')*digit%7][0]&&dp[0][0]){
      cout << "Takahashi" << endl;
    }else{
      cout << "Aoki" << endl;
    }
  }*/
  if(dp[0][0]){
    cout << "Takahashi" << endl;
  }else{
    cout << "Aoki" << endl;
  }
  return 0;
}

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

// #include "ext/pb_ds/assoc_container.hpp"
// #include "ext/pb_ds/tree_policy.hpp"
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
// template<class key, class value, class cmp = std::less<key>>
// using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> ostream& operator<<(ostream &os, set<T> S){os << "{ ";for(auto s:S) os<<s<<" ";return os<<"}";}
template<class T> ostream& operator<<(ostream &os, unordered_set<T> S){os << "{ ";for(auto s:S) os<<s<<" ";return os<<"}";}
template<class T> ostream& operator << (ostream& os, multiset<T> S){os << "{ ";for(auto s:S) os<<s<<" ";return os<<"}";}
//template<class T> ostream& operator<<(ostream &os, ordered_set<T> S){os << "{ ";for(auto s:S) os<<s<<" ";return os<<"}";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {os << "{ ";for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") ";return os<<"}";}
template<class T> ostream& operator<<(ostream &os,vector<T> V){os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";}

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
		const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

//reading vectors
template <class T> void RV(vector<T> &v){for(auto &c : v) cin >> c;}
template <class T> void RV(vector<vector<T>> &v){for(auto &c : v) RV(c);}

//defines and typedefs
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define TC int testcase; cin >> testcase;while(testcase--)
#define forn(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i = 1;i<=n;i++)

#define ALL(x) x.begin(),x.end()
#define int long long int
// #define LL long long int
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define endl "\n"
#define SZ(x) (int)x.size()

typedef pair<int,int>PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;

auto clk=clock();

//constants
int mod = 1e9+7;
const long long inf = 1e17;
const double eps = 1e-6;
const int  LOGN = 25;

// maths stuff
template <class T,class U>T pow_mod(T a,U b,int m= mod){long long  res = 1;while(b){ if(b&1) res =((long long)res*a)%m; a = ((long long)a*a)%m;b >>=1;}return res;}
template <typename T> T inv(T a){return pow_mod(a,mod-2,mod);}
template <typename T> T gcd(T a,T b){if(b == 0) return a;return gcd(b,a%b);}
template <typename T> T lcm(T a,T b){ return a*b /gcd(a,b);}
template <typename T> string to_bin(T num){string binary = "";while (num){binary += (num % 2 == 1 ? "1" : "0");num >>= 1;}reverse(binary.begin(), binary.end());return binary;}
////////////////////////////////////////////////////

void __Solve__(){
    int n,x;
    cin >> n >> x;
    string s;
    cin >> s;
    for(char c : s){
        if(c == 'o') x++;
        else x = max(x-1,0LL);
    }
    cout << x << endl;

}
signed main()
{
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(2);
    FASTIO
#ifdef LOCAL
    freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#endif
    int test_case = 1;
    //cin >> test_case;
    forn(i,test_case){
        //cout << "Case #" << i+1<<": ";
        __Solve__();
    }
#ifdef LOCAL
	cerr<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<"  seconds" << "\n";
#endif
}


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

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

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

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

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;

    ll ans = 0;
    for(int i=0; i<n; i++){
        if(a[i]>10) ans += a[i]-10;
    }
    cout << ans << endl;
    return 0;
}

# include <ciso646>
# include <cstdio>
# include <algorithm>

namespace Main {
    namespace Source {
        typedef signed int dint;
        typedef unsigned int uint;
        static inline const uint abs(const dint x) { return x < 0 ? -x : x; }
        static inline const uint max(const uint a, const uint b) { return a < b ? b : a; }
    }
    using namespace Source;
    enum { N = (const uint)2e5 };
    struct house {
        dint x, y;
        uint id;
        inline const void read(const uint id) { scanf("%d%d", &x, &y), this->id = id; }
        friend inline const uint operator xor (const house& a, const house& b)
        { return max(abs(a.x - b.x), abs(a.y - b.y)); }
        friend inline const bool operator < (const house& a, const house& b) { return a.id < b.id; }
        friend inline const bool cmpx(const house& a, const house& b) { return a.x < b.x; }
        friend inline const bool cmpy(const house& a, const house& b) { return a.y < b.y; }
    };
    static uint n;
    static house h[N + 1];
    static uint mx, my, mi, mj;
    static uint mmx, mmy;
    extern inline const bool cmpx(const house& a, const house& b);
    extern inline const bool cmpy(const house& a, const house& b);
    static inline const bool eq(const uint a, const uint b, const uint c, const uint d)
    { return a == c && b == d or a == d && b == c; }
    static inline const void main() {
        scanf("%u", &n);
        for (register uint i(1); i <= n; ++i) h[i].read(i);
        std::sort(&h[1], &h[n] + 1, cmpx), mx = h[n].x - h[1].x;
        std::sort(&h[1], &h[n] + 1, cmpy), my = h[n].y - h[1].y;
        if (mx >= my) {
            std::sort(&h[1], &h[n] + 1, cmpx), mi = h[1].id, mj = h[n].id;
            mmx = max(h[n - 1].x - h[1].x, h[n].x - h[2].x);
            std::sort(&h[1], &h[n] + 1, cmpy);
            mmy = eq(h[1].id, h[n].id, mi, mj) ? max(h[n - 1].y - h[1].y, h[n].y - h[2].y) : my;
        }
        else {
            std::sort(&h[1], &h[n] + 1, cmpy), mi = h[1].id, mj = h[n].id;
            mmy = max(h[n - 1].y - h[1].y, h[n].y - h[2].y);
            std::sort(&h[1], &h[n] + 1, cmpx);
            mmx = eq(h[1].id, h[n].id, mi, mj) ? max(h[n - 1].x - h[1].x, h[n].x - h[2].x) : mx;
        }
        printf("%u\n", max(mmx, mmy));
    }
}

signed int main() { Main::main(); return 0; }


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

void Main()
{
    int n;
    cin >> n;
    vector<long> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector<long> sa(n+1);
    for (int i = 0; i < n; i++)
    {
        sa[i+1] = sa[i] + a[i];
    }
    long ans = 0;
    for (int i = 0; i < n; i++)
    {
        auto nm = lower_bound(a.begin(), a.end(), a[i]) - a.begin();
        ans += a[i]*nm - sa[nm];
        ans += (sa[n] - sa[nm]) - a[i]*(n-nm);
    }
    ans /= 2;
    cout << ans << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}

#include <iostream>
#include <iomanip>
#include <assert.h>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>

#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<long long, long long> Pll;
typedef std::vector<int> vi;
typedef std::vector<long long> vl;
typedef std::vector<std::string> vs;
typedef std::vector<std::pair<long long, long long>> vpll;
typedef std::vector<std::vector<ll>> vvl;
template<class T> using V = std::vector<T>;
template<class T> using VV = std::vector<std::vector<T>>;

const long double PI = (acos(-1));
const long long MOD = 1000000007;

static const int MAX_INT = std::numeric_limits<int>::max(); // 2147483647 = 2^31-1
static const ll  MAX_LL  = std::numeric_limits<long long>::max();
static const int INF     = (1 << 29);   // cf) INT_MAX   = 2147483647 = 2^31-1
static const ll  INFLL   = (1ll << 61); // cf) LLONG_MAX = 9223372036854775807 = 2^63 - 1

#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#define rrep(i,n) RREP(i,0,n)
#define RREP(i,x,n) for(ll i=(ll)(n)-1ll;i>=(ll)(x);--i)
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define SUM(x) accumulate(ALL(x), 0ll)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

// change min/max
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; }

void Main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll cnt = b - c;
    cout << cnt << endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout << std::fixed << std::setprecision(15);
    Main();

    double tmp;
    cin >> tmp;

    return 0;
}


#include<iostream>
using namespace std;
const int N_MAX = 2505;
const int LIMIT = 10001;

int N;

void read() {
    cin >> N;
}

void work() {
    int toAdd[3] = {6, 10, 15};
    bool used[LIMIT] = {};
    int nAns = 0;
    int ans[N_MAX];

    for (int i = 0; i < 3; ++i) {
        used[toAdd[i]] = true;
        ans[nAns++] = toAdd[i];
    }

    for (int loop = 0; loop < 3; ++loop) {
        for (int i = toAdd[loop] * 2; i < LIMIT && nAns < N; i += toAdd[loop]) {
            if (!used[i]) {
                ans[nAns++] = i;
                used[i] = true;
            }
        }
    }

    for (int i = 0; i < nAns; ++i) {
        if (i) cout << ' ';
        cout << ans[i];
    }
    cout << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
int main(){
    ll n;
    cin>>n;
    int sum=0;
    int i=1;
    while(sum<n){
        sum+=i;
        i++;
    }
    cout<<i-1<<endl;
    return 0;
}


#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
typedef pair<int,pii> P;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n;
	cin>>n;
	vector<ll>a(n);
	ll ans = INF;
	for(int i=0;i<n;i++)cin>>a[i];
	/*
	for(ll i=0;i<(1<<n);i++){
		ll fin = 0;
		for(int j=0;j<n;j++){
			int k = j;
			ll cur = a[j];
			while(k+1<n){
				int c = i&(1LL<<j);
				int b = i&(1LL<<k);
				if(c && !b)break;
				if(b && !c)break;
				k++;
				cur = cur|a[k];
			}
			fin= cur ^ fin;
			j = k;
		}
		ans = min(ans,fin);
	}*/
	vector<set<ll>>b(20);
	for(int i=0;i<n;i++){
		ll cur = 0;
		for(int j=i;j>=0;j--){
			cur = cur|a[j];
			if(j == 0)b[i].insert(cur);
			else{
				for(ll x:b[j-1]){
					b[i].insert(cur ^ x);
				}
			}
		}
	}
	for(ll x:b[n-1])ans = min(ans,x);
	cout<<ans;
}

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=998244353, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll cnt = 0;
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    bool ng = false;
    for(ll k=0;k<=h+w-2;k++) {
        int num = 0;
        for(ll i=min(k, h-1);i>=max(0LL, k-(w-1));i--) {
            ll j = k - i;
            if(s[i][j] == 'R') {
                if(num == 0) num++;
                else if(num == -1) ng = true;
            }else if(s[i][j] == 'B') {
                if(num == 0) num--;
                else if(num == 1) ng = true;
            }
        }
        if(num == 0) cnt++;
    }
    if(ng) {
        cout << 0 << endl;
        return 0;
    }
    cout << modpow(2LL, cnt) << endl;
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}

int main(){

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

    int x;
    cin >> x;
    cout << (x >= 0 ? x : 0) << endl;

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;
const double pi = 3.14159265358979323846264;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main()
{
    ll n;
    cin >> n;
    ll cnt = 1;
    vector<ll> a;
    map<ll, ll> rensou;
    for (ll i = 0; i < 28; i++)
    {
        cnt *= 5;
        a.push_back(cnt);
        rensou[cnt] = i;
        if (cnt * 5 >= n)
        {
            break;
        }
    }
    a.push_back(1000000000000000010);
    cnt = 1;
    bool judge = false;
    for (ll i = 0; i < 40; i++)
    {
        cnt *= 3;
        ll amari = n - cnt;
        auto itr = lower_bound(a.begin(), a.end(), amari);
        if (*itr == amari)
        {
            cout << i + 1 << " " << rensou[amari] + 1 << endl;
            judge = true;
            break;
        }
        if (cnt * 3 >= n)
        {
            break;
        }
    }
    if (!judge)
    {
        cout << -1 << endl;
    }
}


//GIVE ME AC!!!!!!!!!!!!!!!!!
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define all(n) n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
#define rep(i, s, n) for (ll i = s; i < (ll)(n); i++)
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll inf =1e18;
const ll MOD=1000000007;
const ll mod=998244353;
const double pi=acos(-1);
using P=pair<ll,ll>;
ll merge_cnt(vector<ll> &a) {
    ll n = a.size();
    if (n <= 1) { return 0; }
    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin()+n/2);
    vector<ll> c(a.begin()+(n/2), a.end());
    cnt += merge_cnt(b);
    cnt += merge_cnt(c);
    ll ai = 0, bi = 0, ci = 0;
    // merge の処理
    while (ai < n) {
        if ( bi < b.size() && (ci == c.size() || b[bi] <= c[ci]) ) {
            a[ai++] = b[bi++];
        } else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}
int main(){
  int n;
  cin>>n;
  map<int,vector<int>>p;
  int a[n];
  rep(i,0,n){
    cin>>a[i];
    p[a[i]+i].push_back(i);
  }
  int b;
  bool ok=true;
  vector<ll>ans(n);
  rep(i,0,n){
    cin>>b;
    b+=i;
    if(p[b].size()==0){
      ok=false;
      break;
    }
    else{
      ans[p[b][0]]=i;
      p[b].erase(p[b].begin());
    }
  }
  if(!ok){
    cout<<-1<<endl;
    return 0;
  }
  cout<<merge_cnt(ans)<<endl;
}

/*Lucky_Glass*/
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 2e5 + 10;
#define con(typ) const typ &

struct BITArray {
  int arr[N], siz;
  void modify(con(int) pos, con(int) key) {
    for (int i = pos; i <= siz; i += i & -i)
      arr[i] += key;
  }
  int query(con(int) pos) {
    int ans = 0;
    for (int i = pos; i; i -= i & -i)
      ans += arr[i];
    return ans;
  }
} bit;

int n;
std::pair<int, int> posa[N], posb[N];
int rec[N];

int main() {
  scanf("%d", &n);
  for (int i = 1, tmp; i <= n; ++i) {
    scanf("%d", &tmp);
    posa[i] = std::make_pair(tmp + i - 1, i);
  }
  for (int i = 1, tmp; i <= n; ++i) {
    scanf("%d", &tmp);
    posb[i] = std::make_pair(tmp + i - 1, i);
  }
  std::sort(posa + 1, posa + 1 + n);
  std::sort(posb + 1, posb + 1 + n);
  for (int i = 1; i <= n; ++i)
    if ( posa[i].first != posb[i].first ) {
      printf("-1\n");
      return 0;
    } else {
      rec[posa[i].second] = posb[i].second;
    }
  bit.siz = n;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += bit.query(n - rec[i] + 1);
    bit.modify(n - rec[i] + 1, 1);
  }
  printf("%lld\n", ans);
  return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N=1e5+5;
int a[N],T,n;
map<int,int>mp;
void solve(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i);
	rep(i,1,n) mp[a[i]]++;
	bool flag=1;
	rep(i,1,n) if(mp[a[i]]&1){
		flag=0; break;
	}
	if(n%2==0) puts(flag?"Second":"First");
	else puts(flag?"First":"Second");
	mp.clear();
}
int main(){
	scanf("%d",&T);
	while(T--) solve();
	return 0;
}

//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

ll num[524310];
bool kazu[524310];
const int ma = (1 << 19) - 1;
int k;
void add(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] = !kazu[n2];
			k += (kazu[n2] * 2) - 1;
			return;
		}
		n2 = n2 * 2 % 524309;
	}
	num[n2] = n + 1;
	kazu[n2] = 1;
	k++;
}

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

	int T;
	cin >> T;

	rep(t, T) {
		int N;
		cin >> N;

		if (N % 2) {
			rep(i, N) {
				int a;
				cin >> a;
			}
			co("Second");
		}
		else {
			int tmp = k;
			rep(i, N) {
				int a;
				cin >> a;
				add(a + 1000000000ll * t);
			}
			if (tmp == k) co("Second");
			else co("First");
		}
	}

	Would you please return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

struct Ad{ll x, y, r, num;};
struct Recang{
    ll x1, y1, x2, y2;
    ll size(){
        return abs(x2-x1)*abs(y2-y1);
    }
};

const int MAX=9999;
int n;
Ad ads[300];
Recang ans[300];

bool overlap(Recang a, Recang b){
    return max(a.x1,b.x1)<min(a.x2,b.x2)&&max(a.y1,b.y1)<min(a.y2,b.y2);
}

bool check(Recang a, int k){
    REP(i,n){
        if(i==k)
            continue;
        if(overlap(a,ans[i]))
            return 1;
    }
    return 0;
}

void solve(){
    cin >> n;
    int x, y, r;
    REP(i,n){
        cin >> x >> y >> r;
        ads[i]=Ad{x,y,r,i};
    }
    sort(ads,ads+n,[](const Ad& a, const Ad& b){return a.r<b.r;});
    REP(i,n){
        Ad ad=ads[i];
        ans[ad.num]={ad.x,ad.y,ad.x+1,ad.y+1};
    }
    REP(i,n){
        Ad ad=ads[i];
        Recang tmpr={ad.x,ad.y,ad.x+1,ad.y+1};
        while(1){
            bool ok=0;
            tmpr.x1--;
            if(tmpr.x1<0||check(tmpr,ad.num)) tmpr.x1++;
            else ok=1;
            if(tmpr.size()>ad.r) break;
            tmpr.y1--;
            if(tmpr.y1<0||check(tmpr,ad.num)) tmpr.y1++;
            else ok=1;
            if(tmpr.size()>ad.r) break;
            tmpr.x2++;
            if(tmpr.x2>MAX||check(tmpr,ad.num)) tmpr.x2--;
            else ok=1;
            if(tmpr.size()>ad.r) break;
            tmpr.y2++;
            if(tmpr.y2>MAX||check(tmpr,ad.num)) tmpr.y2--;
            else ok=1;
            if(tmpr.size()>ad.r) break;
            if(!ok) break;
        }
        ans[ad.num]=tmpr;
    }
    REP(i,n){
        Recang tmpr=ans[i];
        cout << tmpr.x1 << " ";
        cout << tmpr.y1 << " ";
        cout << tmpr.x2 << " ";
        cout << tmpr.y2 << endl;
    }
}

int main(){
    solve();
    return 0;
}

/**
 *   author:  Niloy_Das
 *   created: 2021-06-06 18:19:58
**/

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

#define mod 1000000007
#define firstio() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fo(i,k,n) for ( i = k; i < n; i++)
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " ";print(x);cerr<<endl;
#else
#define debug(x)
#endif

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

void print(int x){cerr << x;}
void print(ll x){cerr << x;}
void print(double x){cerr << x;}
void print(char x){cerr << x;}
void print(string x){cerr << x;}

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,class V> void print(map <T,V> v) {cerr << endl <<  "[ \n"; for (auto i=v.begin();i!=v.end();i++) {print(i->F); cerr << " "; print(i->S); cerr<<endl;} cerr << "]";}

int n,m;

int bfs(vector<vector<int>> &graph,int source){
    queue<int>q;
    vector<bool>visit(n+1,false);
    q.push(source);
    visit[source] = true;
    int sum = 0;
    while (!q.empty())
    {
        int k = q.front();
        q.pop();
        for(auto it:graph[k]){
            if(!visit[it]){
                sum++;
                q.push(it);
                visit[it] = true;
            }
        }
    }

    return sum;
}

int main()
{
    firstio()
    #ifndef ONLINE_JUDGE
       freopen("Error.txt","w",stderr);
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif

    int t = 1,i;
    // cin >> t;
    while(t--){
         cin >> n >> m;
         vector<vector<int>> graph(n+1);
         fo(i,0,m){
             int a,b;
             cin >> a >> b;
             graph[a].push_back(b);
         }
         int sum=n;
         fo(i,1,n+1){
             sum+=bfs(graph,i);
         }
         cout << sum << "\n";
    }
    return 0;
}


// author : lynmisakura
// TIMESTAMP: 2020-10-17, 20:00:51

#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define REP(i,n) for(int i = 0;i < n;i++)
#define RNG(i,s,n) for(int i = s;i < n;i++)
#define _RNG(i,s,e) for(int i=s;i>=e;i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define dup(x,y) (x + y - 1) / (y)
#define all(x) (x).begin(),(x).end()
#define lb(x,key) lower_bound(all(x) , (key))
#define ub(x,key) upper_bound(all(x) , (key))

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout<<"["<<#a<<","<<#b<<"] = "<<"["<<a<<","<<b<<"]\n"
#define debug3(a,b,c) cout<<"["<<#a<<","<<#b<<","<<#c<<"] = "<<"["<<a<<","<<b<<","<<c<<"]\n"
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
  cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
  return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
  cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
  return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
  for (auto& i : arr)cin >> i; return in;
}
template<class S,class T> istream &operator >> (istream& in,pair<S,T>& p){
  cin >> p.first >> p.second; return in;
}

#define F first
#define S second
/////////////////////////////////////////////////////////////////////////

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

  int n;
  vector<long long> a;
  ld m = 0,u = 0,c = 0;

  cin >> n;
  a.resize(n);
  REP(i,n){
    cin >> a[i];
  }

  REP(i,n){
    m += abs(a[i]);
  }
  REP(i,n){
    u += a[i] * a[i];
  }
  u = sqrt(u);
  c = 0.0;
  REP(i,n){
    if(abs(a[i]) > c) c = abs(a[i]);
  }
  cout << m << '\n';
  cout << u << '\n';
  cout << c << '\n';
  return 0;
}

#include <bits/stdc++.h>
#define LL long long
using namespace std;
int n,C;
LL A,B;
int main()
{
	scanf("%d",&n);
	for (int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		A+=abs(x);
		B+=(LL)x*x;
		C=max(C,abs(x));
	}
	printf("%lld\n%.12f\n%d\n",A,sqrt(B),C);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
// --------------------------------------------------------
template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; }
#define FOR(i,l,r) for (ll i = (l); i < (r); ++i)
#define RFOR(i,l,r) for (ll i = (r)-1; (l) <= i; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((ll)(c).size())
#define BIT(b,i) (((b)>>(i)) & 1)
#define PCNT(b) __builtin_popcountll(b)
#define CIN(c) cin >> (c)
#define COUT(c) cout << (c) << '\n'
#define debug(x) cerr << "l." << __LINE__ << " : " << #x << " = " << (x) << '\n'
ll llceil(ll a, ll b) { return (a + b - 1) / b; }
string toupper(const string& S) { string T(S); REP(i,SZ(T)) T[i] = toupper(T[i]); return T; }
string tolower(const string& S) { string T(S); REP(i,SZ(T)) T[i] = tolower(T[i]); return T; }
using P = pair<ll,ll>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VVS = vector<VS>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VVVLL = vector<VVLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VVVB = vector<VVB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VVVD = vector<VVD>;
using VLD = vector<ld>;
using VVLD = vector<VLD>;
using VVVLD = vector<VVLD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const ll INF = (1LL << 62) - 1;  // 4611686018427387904 - 1
// --------------------------------------------------------
// #include <atcoder/all>
// using namespace atcoder;

// Editorial AC

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

    ll N, M; cin >> N >> M;
    VVP G(N);
    REP(_,M) {
        ll u, v, c; cin >> u >> v >> c;
        u--; v--;
        G[u].push_back(P(v, c));
        G[v].push_back(P(u, c));
    }

    VLL C(N,-1); C[0] = 1;
    queue<ll> q; q.push(0);
    while (!q.empty()) {
        ll u = q.front(); q.pop();
        for (auto& [v, c] : G[u]) {
            if (C[v] != -1) continue;
            if (C[u] == c) {
                C[v] = (c == N ? 1 : c+1);
            } else {
                C[v] = c;
            }
            q.push(v);
        }
    }

    REP(i,N) COUT(C[i]);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}

const ll inf = 1e18;
const ll mod = 1e9 + 7;

int main() {
    ll N, X; cin >> N >> X;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll ans = inf;
    rep(i,N) chmin(ans,X-A[i]);
    for (ll k=2; k<=N; k++) {
        // dp[i][j][k] : A[i]まで見たときj種類使って余りがlである最大値
        vector<vector<vector<ll>>> dp(N,vector<vector<ll>>(k+1,vector<ll>(k,-inf)));
        rep(i,N) dp[i][0][0] = 0LL;
        dp[0][1][A[0]%k] = A[0];
        for (ll i=0; i<N-1; i++) {
            ll a = A[i+1];
            rep(j,k+1) rep(l,k) {
                if (dp[i][j][l]==-inf) continue;
                // 使わない
                chmax(dp[i+1][j][l],dp[i][j][l]);
                if (j+1>k) continue;
                // 使う
                chmax(dp[i+1][j+1][(l+a)%k],dp[i][j][l]+a);
            }
        }
        ll S = dp[N-1][k][X%k];
        if (S==-inf) continue;
        chmin(ans,(X-S)/k);
    }

    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, N) for(int i = 0; i < (int)N; i++)
#define CREP(i, l, r) for(int i = l; i <= r; i++)
const ll LLINF = (1LL << 60);   // > 10^18 ll  2*LLINF

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

    vector<ll> sum(5000010, 0);
    REP(i,5000000) sum[i+1] += sum[i]+i+1;

    ll res = 2;
    for(int k = 2; n >= sum[k]; k++){
        if(n%k == sum[k-1]%k) res += 2;
    }

    cout << res;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin>>n;
	n*=2;
	int ans=0;
	for(ll l=1;l*l<=n;l++){
		if(n%l==0){
			ll t=n/l+1-l;
			if(t%2==0){
				ans++;
				if(t)ans++;
			}
		}
	}
	cout<<ans;
}


#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e5+5;
const int INF = 1e9;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n,m;
        cin>>n>>m;
        string s[n];
        for(int i=0;i<n;i++)cin>>s[i];
        int dist[n][m], vis[n][m] = {};
        pii st,en;
        vector<pii> x[26];
        int done[26] = {};
        pii dir[4] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1} };
        set<pair<int,pii>> all;
        for(int i=0;i<n;i++)for(int j=0;j<m;j++)
        {
            if(s[i][j] == 'S')st = {i,j};
            if(s[i][j] == 'G')en = {i,j};
            if(s[i][j] >= 'a' && s[i][j] <= 'z')x[s[i][j]-'a'].pb({i,j});
            dist[i][j] = s[i][j] == 'S' ? 0 : INF;
            all.insert({dist[i][j],{i,j}});
        }
        while(true)
        {
            auto it = all.begin();
            pii now = it->ss;
            int d = it->ff;
            if(d == INF)break;
            all.erase(it);
            if(now == en)break;
            vis[now.ff][now.ss] = 1;
            for(int i=0;i<4;i++)
            {
                pii ne = {now.ff+dir[i].ff, now.ss+dir[i].ss};
                if(ne.ff>=0 && ne.ss>=0 && ne.ff<n && ne.ss<m && s[ne.ff][ne.ss] != '#' && !vis[ne.ff][ne.ss] && dist[ne.ff][ne.ss] > d + 1)
                {
                    //all.erase({dist[ne.ff][ne.ss], ne});
                    dist[ne.ff][ne.ss] = d + 1;
                    all.insert({dist[ne.ff][ne.ss], ne});
                }
            }
            if(s[now.ff][now.ss] >= 'a' && s[now.ff][now.ss] <= 'z')
            {
                int ind = s[now.ff][now.ss] - 'a';
                if(done[ind])continue;
                for(pii ne: x[ind])
                {
                    if(!vis[ne.ff][ne.ss] && dist[ne.ff][ne.ss] > d + 1)
                    {
                        //all.erase({dist[ne.ff][ne.ss], ne});
                        dist[ne.ff][ne.ss] = d + 1;
                        all.insert({dist[ne.ff][ne.ss], ne});
                    }
                }
                done[ind] = 1;
            }
        }
        int ans = dist[en.ff][en.ss];
        if(dist[en.ff][en.ss] == INF)ans = -1;
        cout<<ans<<endl;
    }
    return 0;
}

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;

// edge[node_from][i] = pair(cost, node_to_i)
vector<long> dijkstra(vector<vector<pair<long, int>>> &edge, int start=0)
{
    priority_queue<pair<long, int>> q;
    int n_node = edge.size();
    vector<long> cost(n_node, -1L);
    q.push(make_pair(0, start));
    while (! q.empty()) {
        auto [now_c, now] = q.top(); q.pop();
        if (cost[now] != -1) continue;
        cost[now] = -now_c;
        for (auto [next_c, next]: edge[now]) {
            if (cost[next] == -1) q.push(make_pair(now_c-next_c, next));
        }
    }
    return cost;
}

void Main()
{
    int h, w;
    cin >> h >> w;
    vector<string> grid(h);
    pair<int, int> start, end;
    vector<vector<pair<int, int>>> potal(256);
    vector<vector<pair<long, int>>> edge(h*w+'z'-'a'+1);
    for (int i = 0; i < h; i++)
    {
        cin >> grid[i];
        for (int j = 0; j < w; j++)
        {
            switch (grid[i][j])
            {
            case 'S':
                start = make_pair(i, j);
                break;
            case 'G':
                end = make_pair(i, j);
                break;
            case '.':
                break;
            case '#':
                break;
            default:
                potal[grid[i][j]].push_back(make_pair(i, j));
                break;
            }
        }
    }
    int d[4][2] = {{-1, 0}, {+1, 0}, {0, -1}, {0, +1}};
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (grid[i][j] == '#') continue;
            for (int k = 0; k < 4; k++)
            {
                int dy = d[k][0];
                int dx = d[k][1];
                if (i+dy>=0 && i+dy<h
                    && j+dx>=0 && j+dx<w
                    && grid[i+dy][j+dx] != '#') {
                    edge[i*w+j].push_back(make_pair(1, (i+dy)*w+(j+dx)));
                    edge[(i+dy)*w+(j+dx)].push_back(make_pair(1, i*w+j));
                }
            }
        }
    }
    for (int c = 'a'; c <= 'z'; c++)
    {
        for (auto [i, j]: potal[c]) {
            edge[i*w+j].push_back(make_pair(1, w*h+c-'a'));
            edge[w*h+c-'a'].push_back(make_pair(0, i*w+j));
        }
    }

    auto cost = dijkstra(edge, start.first*w+start.second);
    cout << cost[end.first*w+end.second] << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  string a;
  cin >> a;
  int i = 0;
  while(a[i]!='.'&&(a[i]=='0'||a[i]=='1'||a[i]=='2'||a[i]=='3'||a[i]=='4'||a[i]=='5'||a[i]=='6'||a[i]=='7'||a[i]=='8'||a[i]=='9')){
    cout << a[i];
    i++;
  }
  return 0;

}

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

int main() {
  string x;
  cin >> x;
  for(int i; i < x.size(); i++) {
    char c = x[i];
    if(c == '.') break;
    else cout << c;
  }
  cout << endl;

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

struct UnionFind{
    private:
    vector<int> par,siz;

    public:
    int con;
    UnionFind(int n):par(n),siz(n,1),con(n){
        iota(begin(par),end(par),0);
    }
    int root(int x){
        return (par[x]==x?x:(par[x]=root(par[x])));
    }
    bool sameroot(int x,int y){
        return root(x)==root(y);
    }
    bool unite(int x,int y){
        x=root(x);y=root(y);
        if(x==y) return false;
        if(siz[x]<siz[y])swap(x,y);
        siz[x]+=siz[y];
        par[y]=x;
        con--;
        return true;
    }
    int size(int x){
        return siz[root(x)];
    }
};

signed main(){
    int h,w;cin>>h>>w;
    UnionFind uf(h+w);
    rep(i,h){
        rep(j,w){
            char c;cin>>c;
            if(c=='#'){
                uf.unite(i,h+j);
            }
        }
    }

    uf.unite(0,h);
    uf.unite(0,h+w-1);
    uf.unite(h-1,h);
    uf.unite(h-1,h+w-1);

    int res=INF;
    // left
    {
        UnionFind l(h);

        vector<vector<int>> v(h+w);
        rep(i,h) v[uf.root(i)].push_back(i);
        rep(i,h+w){
            if(v.empty()) continue;
            for(int j=1;j<(int)v[i].size();j++) l.unite(v[i][0],v[i][j]);
        }
        chmin(res,l.con-1);
    }
    {
        UnionFind r(w);

        vector<vector<int>> v(h+w);
        rep(i,w) v[uf.root(h+i)].push_back(i);
        rep(i,h+w){
            if(v.empty()) continue;
            for(int j=1;j<(int)v[i].size();j++) r.unite(v[i][0],v[i][j]);
        }
        chmin(res,r.con-1);
    }
    cout<<res<<endl;
    return 0;
}

/*

4 5
.....
.###.
.....
.....

*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define li long long
#define pii pair<int, int>
#define vi vector<int>
#define li long long

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

const int MAXN = 2005;

bool visited[MAXN];
vi edges[MAXN];
int n, m;

void dfs(int v) {
	visited[v] = true;
	for (int u : edges[v]) {
		if (!visited[u])
			dfs(u);
	}
}

void add_edge(int row, int col) {
	edges[row].pb(col + n);
	edges[col + n].pb(row);
}

int main() {
	scanf("%d%d", &n, &m);
	forn(i, n) {
		string s;
		cin >> s;
		forn(j, m) {
			if (s[j] == '#') {
				add_edge(i, j);
			}
		}
	}
	/*forn(i, n) {
		add_edge(i, 0);
		add_edge(i, m - 1);
	}
	forn(j, m) {
		add_edge(0, j);
		add_edge(n - 1, j);
	}*/
	add_edge(0, 0);
	add_edge(0, m);
	add_edge(n - 1, 0);
	add_edge(n - 1, m - 1);
	int row_comp = 0;
	forn(i, n) {
		if (!visited[i]) {
			++row_comp;
			dfs(i);
		}
	}
	memset(visited, false, sizeof(visited));
	int col_comp = 0;
	fore(i, n, n + m - 1) {
		if (!visited[i]) {
			++col_comp;
			dfs(i);
		}
	}
	//cerr << row_comp << " " << col_comp << endl;
	printf("%d", min(row_comp - 1, col_comp - 1));
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORX(i, a, b, x) FOR (ll i = (a); i <= (b); i+=x)
#define debug(x) cerr << #x << " is= " << x << endl; //use FOR debugging
#define read(a) int a; cin >> a;
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define mp(a,b) make_pair(a,b)
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vov        vector<vector<int>>
#define pr         pair<int,int>
#define vpll       vector<pair<ll,ll>>
#define all(v)     v.begin(),v.end()
#define rall(v)    v.rbegin(),v.rend()  //reverse of above;
#define sz(container) int((container).size())
#define cut(x) {cout<<x<<"\n"; return;}
#define setprec(x) cout << fixed << showpoint << setprecision(15)<<x<<"\n";
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define time cout << clock() / double(CLOCKS_PER_SEC) << endl;
#define endl "\n";
#define cntbit(x) __builtin_popcount(x);
#define fi first
#define se second
#define mod 1000000007
#define mod1 998244353
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
//*s.find_by_order() ->returns an iterator to the k-th largest element (counting from zero);
//s.order_of_key() ->number of elements strictly smaller then our item;
//st.rbegin()->second; last element in set
//st.erase(prev(st.end())); delete last element in set;
//sort(a+1,a+n+1,[](ll x,ll y){return abs(x)>abs(y);});
//sort(v.begin(), v.end(), greater<int>());
const int N=2e5+5;
const ll inf=1e18;
ll n,a[N],ma=0;
set<ll>s;
void solve()
{
 FOR(i,1,n)
 {
  s.insert(a[i]);
   if(ma==a[i])
  {
    while(s.find(ma)!=s.end()) ma++;
  }
  cout<<ma<<endl;
 }
}
int main()
{

  fast_io;
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  cin>>n;
  FOR(i,1,n) cin>>a[i];
  solve();
}

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
const int maxr = 1e5 + 5;

int solve(int idx, vector<bool> &vis, string &s) {

    if(idx == 4) {
        int flag = 1;
        for(int i = 0; i < 10; i++) {
            if(s[i] == 'o' && !vis[i])
                flag = 0;
        }
        return flag;
    }
    int cnt = 0;
    for(int i = 0; i < 10; i++) {
        if(s[i] == 'o' || s[i] == '?') {
            bool temp = vis[i];
            vis[i] = true;
            cnt += solve(idx + 1, vis, s);
            vis[i] = temp;
        }
    }
    return cnt;
}

int32_t main()
{
    GO;
    string s;
    cin >> s;

    int cnt = 0;
    for(auto x: s)
        if(x == 'o') cnt++;

    if(cnt > 4) {
        cout << 0 << endl;
        return 0;
    }
    vector<bool> vis(10, 0);
    int ans = solve(0, vis, s);
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define fore(i_in,a) for (auto& i_in: a)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fio() cin.tie(nullptr);ios::sync_with_stdio(false);
#define DEBUG_CTN(v) cerr<<#v<<":";for(auto itr=v.begin();itr!=v.end();itr++) cerr<<" "<<*itr; cerr<<endl
template<class T> bool chmax(T &a, const T &b) {if (a<b) { a = b; return true; } return 0;}
template<class T> bool chmin(T &a, const T &b) {if (a>b) { a = b; return true; } return 0;}
template<class T> void print(const T &t) { cout << t << "\n"; }
const ll INF = 1LL << 62;
const int iINF = 1 << 30;

#define pq(T) priority_queue<T, vector<T>, greater<T>>
struct Edge {ll to; ll w; Edge(ll to, ll w) : to(to), w(w) {}};
using Graph = vector<vector<Edge>>;

vl dijkstra(Graph &G, int s){
    int n = G.size();
    vl dist(n, INF);
    dist[s] = 0;

    using pp = pair<ll, ll>;
    pq(pp) que;
    que.push({dist[s], s});

    while (!que.empty()) {
        ll v = que.top().second;
        ll d = que.top().first;
        que.pop();

        if (d > dist[v]) continue;
        if(!G[v].empty()) fore(e, G[v]) {
            if (chmin(dist[e.to], dist[v] + e.w)) {
                que.push({dist[e.to], e.to});
            }
        }
    }
    return dist;
}

int n;

int main() {
    fio(); cin>>n;
    Graph E(n+1);
    rep1(i,n){
        ll x = (2*i)%n+1, y=(2*i+1)%n+1;
        cout<<x<<" "<<y<<"\n";
        E[i].emplace_back(x,1);
        E[i].emplace_back(y,1);
    }
    ll ans = 0;
    rep1(i,n) {
        vl dist = dijkstra(E,i);
        ll tmp = 0;
        rep1(i,n) chmax(tmp,dist[i]);
        chmax(ans,tmp);
    }
}

// Created by ...
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

#define vll vector< ll >
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<ll,ll>
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;
using ll = long long;
ll md=MD;

ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(ll a,ll b){if(a<b)return a; return b;}
ll Max(ll a,ll b){if(a>b)return a; return b;}

bool check(int a,int b,int c,int d){
	return ((abs(a-c)+abs(b-d)<=3) || (a+b==c+d) || (a-b==c-d));
}
int32_t main() {
    IOS;

   		vec(pii) v;
    	rep(i,-2,2)rep(j,-2,2)v.pb({i,j});
    	v.pb({-3,0});v.pb({3,0});v.pb({0,-3});v.pb({0,3});
        int a,b,c,d; cin>>a>>b>>c>>d;
        if(a==c && b==d)cout<<"0";
        else if(check(a,b,c,d))cout<<"1";
        else{
        	for(auto&p:v){
        		if(check(a+p.fi,b+p.se,c,d) || check(a,b,c+p.fi,d+p.se)){cout<<"2"; return 0;}
        	}
        	int k1=abs(a-b+c-d);
        	if(k1%2==0){
        		cout<<"2";
        		return 0;
        	}
        	cout<<"3";
        }

        cout<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define x() real()
#define y() imag()
#define vec(a, b) ((b) - (a))
#define dot(a, b) (conj(a) * (b)).real()
#define fastIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
const ld eps = 1e-6;
const int N = 2e5 + 7;
ll values[N];
ll all = 0;
vector<int> g[N];
pair<int, int> edges[N];
int parent[N];
int in[N];

void dfs(int node, ll value, int par) {
    values[node] += value;
    for (auto i : g[node]) {
        if (i != par)
            dfs(i, values[node], node);
    }
}

void dfs1(int node, int par) {
    parent[node] = par;
    for (auto i : g[node]) {
        if (i != par) {
            dfs1(i, node);
        }
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n-1; i++) {
        int a, b;
        cin >> a >> b;
        edges[i] = {a, b};
        g[a].push_back(b);
        g[b].push_back(a);
        in[b]++;
    }
    int root = 1;
    dfs1(root, -1);
    int q;
    cin >> q;
    while (q--) {
        ll t, e, x;
        cin >> t >> e >> x;
        int a = edges[e].first, b = edges[e].second;
        if (t == 1) {
            // a, b
            if (parent[b] == a) {
                all += x;
                values[b] -= x;
            }
            else {
               values[a] += x;
            }
        }
        else {
            if (parent[a] == b) {
                all += x;
                values[a] -= x;
            }
            else {
                values[b] += x;
            }
        }
    }
    dfs(root, all, -1);
    for (int i = 1; i <= n; i++) {
        cout << values[i] << '\n';
    }
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
template<typename T> bool chmax(T &a, T b) {if(a<b){a=b; return 1; } return 0; }
template<typename T> bool chmin(T &a, T b) {if(a>b){a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
ll mpow(ll x, ll p) {
	if (p==0) return 1;
	ll res=mpow(x,p/2); res=res*res%MOD;
	return p%2?res*x%MOD:res;
}
ll lpow(ll x, ll p) {
	if (p==0) return 1;
	ll res=lpow(x,p/2); res*=res;
	return p%2?res*x:res;
}

vector<int> to[200005];
int par[200005];
int seen[200005];

ll imos[200005];

void dfs(int prev, int cur) {
	par[cur] = prev;
	seen[cur] = 1;
	if (prev != -1) imos[cur] += imos[prev];
	for (int nx: to[cur]) {
		if (seen[nx]) continue;
		dfs(cur, nx);
	}
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n-1), b(n-1);
	// 隣接リストにデータを追加
	rep(i,n-1) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		to[a[i]].push_back(b[i]);
		to[b[i]].push_back(a[i]);
	}
	// 0を根として、各頂点の親を記録する
	dfs(-1, 0);
	int q;
	cin >> q;
	rep(i,q) {
		int t, e, x;
		cin >> t >> e >> x;
		e--;
		int v = a[e], u = b[e];
		// tが2のときは、vとuをswapすれば操作が同じになる
		if (t == 2) swap(v, u);
		if (par[u] == v) {
			imos[0] += x;
			imos[u] -= x;
		}
		else {
			imos[v] += x;
		}
	}
	// seenの値を0にして、再度dfsを実行する
	rep(i,n) seen[i] = 0;
	dfs(-1, 0);
	rep(i,n) cout << imos[i] << endl;
}


#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <iomanip>
#include <cmath>
#include <set>
#include <unordered_set>
#include <functional>
#include <map>
#include <unordered_map>
#include <string>
#include <tuple>
#include <deque>
using namespace std;
using ll = long long;
const int MOD=1e9+7;
const int MAX=100009;
ll fac[100009],finv[100009],inv[100009];

#define pi 3.14159265358979323846
#define ee 2.71828182845904523536
#define INF 1e18

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

bool prime(ll x) { //素数判定
    if(x==1)return false;
    if (x!=2&&x % 2 == 0)return false;
    for (ll i = 3; i <= sqrt(x); i+=2) {
        if (x % i == 0)return false;
    }
    return true;
}

ll modinv(ll a, ll m) { //逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n, ll mod) { //二分累乗法
    ll res = 1;
    while (n) {
        if (n % 2)res = res * a % mod;
        a = a * a % mod;
        n /= 2;
    }
    return res;
}

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

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

struct UnionFind {   // UnionFind
    vector<int> par;
    vector<int> siz;

    UnionFind(int N) : par(N), siz(N, 1) {
        for (int i = 0; i < N; i++) par[i] = i;
    }

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

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (par[rx] > par[ry])swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    int size(int x) {
        return siz[root(x)];
    }
};

int main() {
    int n;
    cin>>n;
    ll dp[100009][2]={};
    dp[0][0]=1;
    for(int i=0;i<n-1;i++){
        dp[i+1][0]+=dp[i][0]+dp[i][1];
        dp[i+1][0]%=MOD;
        dp[i+1][1]+=dp[i][0];
        dp[i+1][1]%=MOD;
    }
    ll a[100009];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll ans=a[0]*((dp[n-1][0]+dp[n-1][1])%MOD)%MOD;
    for(int i=1;i<n;i++){
        ans+=a[i]*((dp[i-1][0]+dp[i-1][1])%MOD*((dp[n-i-1][0]+dp[n-i-1][1])%MOD)%MOD-dp[i-1][0]*dp[n-i-1][0]%MOD);
        ans%=MOD;
        if(ans<0)ans+=MOD;
    }
    cout<<ans<<endl;
}

using namespace std;
#include <bits/stdc++.h>
#define N 100005
#define ll long long
#define mo 1000000007
int n;
ll a[N];
int main(){
	ll x;
	scanf("%d",&n);
	for (int i=1;i<=n;++i)
		scanf("%lld",&a[i]);
	ll c0=1,s0=a[1],c1=0,s1=0;
	for (int i=2;i<=n;++i){
		ll _c0=c0+c1,_s0=s0+s1+_c0*a[i];
		ll _c1=c0,_s1=s0-_c1*a[i];
		c0=_c0%mo,s0=_s0%mo;
		c1=_c1%mo,s1=_s1%mo;
	}
	ll ans=((s0+s1)%mo+mo)%mo;
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
constexpr double eps = 1e-6;
constexpr ll LINF = 100200300400500600ll;
constexpr int INF = 2*((1<<30)-1)+1;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
constexpr int dx[4] = {0,1,0,-1};
constexpr int dy[4] = {-1,0,1,0};
// constexpr int mod = 1000000007;
constexpr ll mod = 998244353;

#define Yes(ifeq) cout<<(( ifeq )? "Yes":"No")<<endl;

void Main(){
  ull n_;
  cin>>n_;
  ull n=n_;
  // ull ans=0;g++-10
  ull len=to_string(n).length();
  ull num=1,ans=0;
  for(ull i=1;i<len;i++){
    num*=10;
    ans+=(num-num/(ull)10)*max(((i-(ull)1)/(ull)3),(ull)0);
  }
  ans+=(n+1-num)*((len-(ull)1)/(ull)3);
  cout<<ans<<endl;

} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}

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

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
#define f first
#define s second
#define nl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MOD = 1e9+7;
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

// int dp[101][2];
int a, b, x, y;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  cin >> a >> b >> x >> y;
  cout << (a==b?x:min(a>b?(a-b-1)*y+x:(b-a)*y+x, (a>b? (a-b)*(2*x)-x: (2*b-2*a+1)*x)));
}


#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define PB push_back
#define MP make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pdd pair<ld, ld>
#define ft first
#define sd second
#define i2 array<int,2>
#define i3 array<int,3>
#define i6 array<int,6>
#define i4 array<int,4>
#define l2 array<ll,2>
#define l3 array<ll,3>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template<class T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const int N = 500100;
const int M = 300100;
const int BIG = int(5e8) + 10;
const int oo = 2e9;
const ll OO = 1e18;
const int md = int(1e9) + 7;
const int PW = 60;
const ld E = 1e-9;
const int MX = 1000100;

mt19937 rnd(chrono::system_clock().now().time_since_epoch().count());

void BAD(){
    cout << -1;
    exit(0);
}

int mult(int x, int y) { return (1ll * x * y) % md; }

int sum(int x, int y){
    x += y;
    if (x >= md)
        x -= md;
    return x;
}

ll mx = 0, SUM = 0, cur = 0, n;

int main(){
#ifdef _LOCAL
    freopen("in.txt","r",stdin); // freopen("output.txt","w",stdout);
#else
//    freopen("mining.in","r",stdin); freopen("mining.out","w",stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif

    cin >> n;

    for (ll i = 1; i <= n; i++){
        ll x; cin >> x;

        SUM += x;

        cur += SUM;

        mx = max(mx, x);

        cout << cur + mx * i << '\n';
    }

    return 0;
}

#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int 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)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define nl '\n'
#define endl '\n'
#define all(c) begin(c), end(c)
#define ok() puts(ok ? "Yes" : "No");
#define pcnt(x) __builtin_popcountll(x)
#define df(x) ll x = in();
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vs = vector<string>;
using P = pair<ll, ll>;
using gt = greater<P>;
template <class T> using minq = priority_queue<T, vector<T>, greater<T>>;
using vP = vector<P>;
inline ll in() {
  ll x;
  scanf("%lld", &x);
  return x;
}
template <class T> void takeUnique(vector<T> &v) {
  auto last = std::unique(v.begin(), v.end());
  v.erase(last, v.end());
}
template <class T> void print(const initializer_list<T> &il) {
  for (auto x : il) {
    cout << x << " ";
  }
  cout << "\n";
}
inline void priv(vll a) {
  rep(i, (int)a.size() - 1) cout << a[i] << " ";
  cout << a.back() << nl;
}
inline void priv(vi a) {
  rep(i, (int)a.size() - 1) cout << a[i] << " ";
  cout << a.back() << nl;
}
const ll LINF = 8e18L + 1;
const int INF = 8e9 + 1;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int dxx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dyy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// g++ -std=c++17 -stdlib=libc++
#define _GLIBCXX_DEBUG
// This slows down the execution; even the time complexity, since it checks if
// std funcs such as lower_bound meets prereqs

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(16);
  int n;
  cin >> n;
  vll a(n);
  rep(i, n) cin >> a[i];
  ll mx = 0;
  ll t = 0;
  vll SS(n + 1);
  rep(i, n) SS[i + 1] += SS[i] + a[i];
  rep(i, n) {
    chmax(mx, a[i]);
    ll now = (i + 1) * mx;
    t += SS[i + 1];
    now += t;
    cout << now << nl;
  }
  return 0;
}


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

using namespace std;

int main(void)
{
    double ans=0;
    double a=0,b=0;

    cin >> a >> b;

    ans=a*b/100;
    cout << ans << endl;
    return 0;
}

/* For you,
                who has never forgotten
                the magic.
                It wants you to know
                it remembers you too.*/
/*J. M. D.  */
#include <bits/stdc++.h>
using namespace std;
#define int             long long
#define pll             pair<int,int>
#define ppll            pair<string,pair<string, string>>
#define vvll            vector<vector<int>>
#define l_b             lower_bound
#define u_b             upper_bound
#define vll             vector<int>
#define vpll            vector<pll>
#define vc              vector <char>
#define vs              vector <string>
#define pb              emplace_back
#define p_b             pop_back()
#define prq             priority_queue
#define setbits(x)      __builtin_popcountll(x)
#define sps(x,y)        fixed<<setprecision(y)<<x
#define hell            1000000007
#define rep(i,s,n)      for(int i=s;i<n;i++)
#define ff              first
#define mem(arr,x)      memset(arr,x,sizeof(arr))
#define ss              second
#define pi              3.14159265358979323846
#define all(v)          v.begin(),v.end()
#define allr(x)         x.rbegin(),x.rend()
#define mp              make_pair
#define display(x)      for(auto dsp:x)cout<<dsp<<" "; cout<<"\n";
#define INF             1000000000000000000//18
void fast()
{
  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 = 5e6+100;
// const int BLK= 555;

//---------------------------------------------
int dr[4] = {0, 0, 1,-1};
int dc[4] = {1,-1, 0, 0};

int ddr[8]= {0, 0, 1, -1, 1, -1, 1, -1};
int ddc[8]= {1, -1, 0, 0, 1, -1, -1, 1};

int ddr1[8]= {1, 1, -1, -1, 2, 2, -2, -2};
int ddc1[8]= {2, -2, 2, -2, 1, -1, 1, -1};
//--------------------------------------------

int32_t main() {
       fast();
    // int t,z;
    // cin>>t;
    // rep(z,1,t+1){
    // cout<<"Case #"<<z<<": ";

    double a, b;
    cin>>a>>b;

    double ans= (a*b)/100;
    cout<<sps(ans, 6)<<"\n";
  }


#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define flc(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define vec vector<lint>
#define nep(x) next_permutation(all(x))
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=3e5+5;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//vector<int> bucket[MAX_N/1000];
constexpr lint MOD=1000000007;
//constexpr int MOD=998244353;
/*#include<atcoder/all>
using namespace atcoder;
typedef __int128_t llint;*/

int main(void){
    int N;
    cin >> N;
    lint A[N];
    rep(i,N) cin >> A[i];
    lint ans=0;
    lint plus=1,minus=0;
    lint fib[N+1]={};
    fib[0]=1,fib[1]=1;
    rep(i,N-1) fib[i+2]=(fib[i+1]+fib[i])%MOD;
    rep(i,N){
        lint mul=(plus*fib[N-i]-minus*fib[N-i-1]+MOD*MOD)%MOD;
        ans=(ans+mul*A[i])%MOD;
        lint np=(plus+minus)%MOD;
        lint nm=(plus)%MOD;

        plus=np,minus=nm;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) begin(v), end(v)
#define sz(v) v.size()
#define INF 1e17
#define EPSILON 1e-14
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;
}

bool collision_detection(ll a, ll b, ll c, ll d, ll e, ll f, ll g, ll h){
    pair<long double, long double> center1 = {(a+c)/2.0, (b+d)/2.0};
    pair<long double, long double> center2 = {(e+g)/2.0, (f+h)/2.0};
    long double x_dist = abs(center1.first - center2.first);
    long double y_dist = abs(center1.second - center2.second);
    if(x_dist >= (c-a)/2.0 + (g-e)/2.0){
        return false;
    }
    if(y_dist >= (d-b)/2.0 + (h-f)/2.0){
        return false;
    }
    return true;
}

vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
           if(i*i != n){
               ret.push_back(n/i);
           }
       }
   }
   sort(all(ret));
   return ret;
}

int main()
{
    random_device rd;
    seed_seq seed = {rd()};
    mt19937 engine(seed);
    uniform_int_distribution<> dist(0, 9999);
    ll n;
    cin >> n;
    vector<ll> x(n), y(n), r(n);
    rep(i, n){
        cin >> x.at(i) >> y.at(i) >> r.at(i);
    }
    vector<tuple<ll, ll, ll, ll>> ads(n);
    rep(i, n){
        rep(j, r.at(i)){
            ll factor = pow(2,8);
            vector<ll> divisors = enum_div((r.at(i)-j)/factor);
            bool put = false;
            ll cnt = 0;
            for(ll div : divisors){
                if(cnt <= 8){
                    cnt++;
                    continue;
                }
                ll a = x.at(i);
                ll b = y.at(i);
                ll c = a + div;
                ll d = b + ((r.at(i)-j)/factor)/div;
                if(c > 10000 || d > 10000){
                    continue;
                }
                bool hit = false;
                rep(k, i){
                    if(collision_detection(a, b, c, d, get<0>(ads.at(k)), get<1>(ads.at(k)), get<2>(ads.at(k)), get<3>(ads.at(k)))){
                        hit = true;
                        break;
                    }
                }
                if(hit){
                    continue;
                }
                ads.at(i) = {a, b, c, d};
                put = true;
                break;
            }
            if(put){
                break;
            }
            if(j == r.at(i)-1){
                bool make = false;
                while(!make){
                    ll p = dist(engine);
                    ll q = dist(engine);
                    rep(k, i){
                        if(collision_detection(p, q, p+1, q+1, get<0>(ads.at(k)), get<1>(ads.at(k)), get<2>(ads.at(k)), get<3>(ads.at(k)))){
                            break;
                        }
                        if(k == i-1){
                            ads.at(i) = {p, q, p+1, q+1};
                            make = true;
                            break;
                        }
                    }
                }
            }
        }
        //cerr << i << endl;
    }
    rep(i, n){
        cout << get<0>(ads.at(i)) << " " << get<1>(ads.at(i)) << " " << get<2>(ads.at(i)) << " " << get<3>(ads.at(i)) << '\n';
    }
}


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

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define db(x) cout << '>' << #x << ':' << x << endl;
#define sz(x) ((int)(x).size())
#define newl cout << "\n"

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

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

const int MAXN = 200005;
vector<vector<int>> g(MAXN), gr(MAXN);
vector<bool> used(MAXN);
vector<int> order, component;

void dfs1(int v) {
  used[v] = true;
  for (size_t i = 0; i < g[v].size(); ++i)
    if (!used[g[v][i]])
      dfs1(g[v][i]);
  order.push_back(v);
}

void dfs2(int v) {
  used[v] = true;
  component.push_back(v);
  for (size_t i = 0; i < gr[v].size(); ++i)
    if (!used[gr[v][i]])
      dfs2(gr[v][i]);
}

int solve() {
  cin >> n >> m;
  vll arr(n);
  rep(i, 0, n) cin >> arr[i];
  vll final(n);
  rep(i, 0, n) cin >> final[i];
  // m edges

  // graph
  rep(i, 0, m) {
    ll u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].pb(v);
    g[v].pb(u);
    gr[v].pb(u);
    gr[u].pb(v);
  }
  used.assign (n, false);
  for (int i=0; i<n; ++i)
    if (!used[i])
      dfs1 (i);
  used.assign (n, false);

  for (int i=0; i<n; ++i) {
    int v = order[n-1-i];
    if (!used[v]) {
      dfs2 (v);
      // logic for this component
      ll arrsum = 0;
      ll finalsum = 0;
      for(auto x:component) {
        arrsum += arr[x];
        finalsum += final[x];
      }
      if(arrsum != finalsum) {
        cout<<"No";
        return 0;
      }
      component.clear();
    }
  }
  cout << "Yes";
  return 0;
}

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  solve();

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
#define fi first
#define se second
#define sz(c)  ((int)(c).size())
#define all(c) (c).begin(), (c).end()
#define forn(i, m, n)  for (int i = m, nnnn = (n); i < nnnn; ++i)
#define pb  push_back
#define mp  make_pair
#define NIL 0
#define INF INT_MAX
#define int128 __int128_t

// greatest common divisor
ll gcd(ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}

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

// sieve of eratosthenes with smallest prime factor
vector<int> sieve;
void prime_sieve(int n){
    sieve.reserve(n+1);
    forn(i, 0, n+1) sieve[i] = i;
    forn(i, 2, n+1){
        if (sieve[i] == i){
            forn(j, 2, n/i+1){
                if (sieve[i*j] == i*j) sieve[i*j] = i;
            }
        }
    }
}

// normalise input to be in range of modulo
// faster than % when close to P
ll norm(ll a, ll P) {
    while (a >= P) a -= P;
    while (a < 0) a += P;
    return a;
}

// multiply and modulo
ll mul_mod(ll a, ll b, ll P) {
    return a * b % P;
}

// power and modulo (log n)
ll pow_mod(ll a, ll b, ll P){
    ll curr = a, ans = 1;
    while(b != 0){
        if (b&1) {
            ans *= curr;
            ans%=P;
        }
        curr *= curr;
        curr %= P;
        b >>= 1;
    }
    return ans;
}

// calculate modulo inverse (log n)
ll inv_mod(ll a, ll P) {
    return pow_mod(a, P - 2ll, P);
}

// calculate modulo inverse (log n)
ll div_mod(ll a, ll b, ll P) {
    return a * inv_mod(b, P) % P;
}

// most significant bit (log n)
int msb(ll a){
    for(int i = 62; i >= 0; i--){
        if (a & ((ll)1 << i)) return i + 1;
    }
    return 0;
}

// Factorial
vector<ll> fact;
void Fact(int n, ll P){
    if (fact.size() < 1) fact.pb(1);
    forn(i, fact.size(), n+1) fact.pb(fact[i-1] * i  % P);
}

void Fact(int n){
    if (fact.size() < 1) fact.pb(1);
    forn(i, fact.size(), n+1) fact.pb(fact[i-1] * i);
}

vector<ll> fact_inv;
void Fact_inv(int n, ll P){
    if (fact_inv.size() < 1) fact_inv.pb(1);
    forn(i, fact_inv.size(), n+1) fact_inv.pb(fact_inv[i-1] * inv_mod(i, P) % P);
}

// Combinations
ll nCr(int n, int r, ll P){
    if (r > n) return 0;
    Fact(n, P);
    Fact_inv(n, P);
    return (fact[n] * fact_inv[r] % P) * fact_inv[n-r] % P;
}

ll nCr_inv(int n, int r, ll P){
    if (r > n) return 0;
    Fact(n, P);
    Fact_inv(n, P);
    return (fact_inv[n] * fact[r] % P) * fact[n-r] % P;
}

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

// Mod
const ll mod = 1000000007;

void solve(){
	int l, r;
    cin >> l >> r;
    vector<int> pf(r+1, 0);
    vector<bool> distinct(r+1, true);
    forn(i, 2, r+1){
        if(!pf[i]){
            for(int j = i, mul = 1; j <= r; j+=i, mul++) {
                pf[j]++;
                if (!(mul % i)) distinct[j] = false;
            }
        }
    }
    ll cnt= 0, cnt2=0;
    for(ll i = 2; i <= r; i++) if(distinct[i]) {
        if (pf[i]&1) cnt += (r/i - (l-1)/i) * (r/i - (l-1)/i - 1);
        else cnt -= (r/i - (l-1)/i) * (r/i - (l-1)/i - 1);
    }
    forn(i, max(l, 2), r+1) cnt2 += r/i-1;
    cout << cnt - cnt2*2;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << setprecision(16) << fixed;
    solve();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=200005,INF=1<<30;

int main(){

    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N,M;cin>>N>>M;
    vector<int> cnt(10000);
    for(int i=0;i<N;i++){
        int a;cin>>a;
        cnt[a]++;
    }

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

    for(int i=1;i<=1000;i++){
        if(cnt[i]==1) cout<<i<<" ";
    }
    cout<<endl;
}

#include <bits/stdc++.h>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
using ld=long double;
ll I=1167167167167167167;
ll Q=1e9+7;
#define rep(i,a) for (ll i=0;i<a;i++)
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end());reverse(v.begin(),v.end());}
template<class T> void print_tate(vector<T> &v) {rep(i,v.size()) cout<<v[i]<<"\n";}
void yneos(bool a){if(a) cout<<"Yes"<<"\n"; else cout<<"No"<<"\n";}

//頑張る
int main() {
	ll N,M;
	cin>>N>>M;
	vector<ll> p(1001);
	rep(i,N){
		ll a;
		cin>>a;
		p[a]^=1;
	}
	rep(i,M){
		ll a;
		cin>>a;
		p[a]^=1;
	}
	rep(i,1001){
		if(p[i]==1) cout<<i<<" ";
	}
	cout<<endl;
}


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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N;
    cin >> N;

    ll MA = 90;
    V<ll> fib(MA);
    fib[0] = 0;
    fib[1] = 1;
    REP(i, MA-2) fib[i+2] = fib[i+1] + fib[i];

    ll x = N;
    V<ll> ids;
    REP(i, MA-1){
        if(x >= fib[MA-1-i]){
            ids.push_back(MA-1-i);
            x -= fib[MA-1-i];
        }
    }

    ll sz = ids.size();

    V<ll> X = ids, Y = ids;
    REP(i, sz) Y[i]--;

    V<ll> res;
    for(ll t=0;;t++){
        REP(i, sz){
            if(X[i] == 1){
                X[i]--;

                if(t%2==0) res.push_back(1);
                else res.push_back(2);
            }
        }

        bool ok = true;
        REP(i, sz) if(X[i] != 0) ok = false;
        REP(i, sz) if(Y[i] != 0) ok = false;
        if(ok) break;

        REP(i, sz){
            if(X[i] >= 2){
                X[i] -= 2;
            }
        }

        if(t%2 == 0) res.push_back(3);
        else res.push_back(4);

        swap(X, Y);
    }

    reverse(ALL(res));
    cout << res.size() << endl;
    for(auto x: res) cout << x << endl;

    return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#include <numeric>
#include <tuple>
#include <cassert>
#include <random>
#include <chrono>
#include <ext/rope>
#include <unordered_map>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define sz(x) (x).size()
#define lbt(x) ((x)&(-x))
#define all(x) (x).begin(),(x).end()
#define mem(a,b) memset(a,b,sizeof(a))
#define fun function
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define mkp make_pair
#define pii pair<int,int>
#define pdi pair<double,int>
#define pdd pair<double,double>
#define mod 1000000007

#define int long long

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long ll;
typedef unsigned long long ull;
typedef rope<char> RPstring;
typedef __gnu_pbds::tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> RBtree;
/*rk = t.order_of_key(v)+1, get_k = *t.find_by_order(k)*/ /*idx begin of 0*/
typedef __gnu_pbds::priority_queue<pii,greater<pii>,pairing_heap_tag> PQ_pii_s;//small
typedef __gnu_pbds::priority_queue<pii,less<pii>,pairing_heap_tag> PQ_pii_b;//big
// gp_hash_table<T,T> x
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
int tt;

inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {if(a<0)putchar('-'),a=-a;if(a>=10)out(a/10);putchar(a%10+'0');}
#define pnt(x) out(x),puts("")
#define put(x) out(x), putchar(' ')
#define putschar(x) putchar(x), puts("")

//int t[maxn];
//void upd(int p, int x) {for(;p<=n;p+=lbt(p))t[p]+=x;}
//int ask(int p) {int ret = 0;for(;p;p-=lbt(p))ret+=t[p];return ret;}

int bit_cnt(int x) {int res=0;while(x)res+=x&1,x>>=1;return res;}
int INT(string x, int sys) {int base=sys,res=0;for(auto i: x)res*=sys,res+=i-'0';return res;}//sys->10
string TNI(int x, int sys) {string res="";while(x)res+=x%sys+'0',x/=sys;reverse(all(res));return res;}//10->sys

int gcd(int a, int b) {return b?gcd(b,a%b):a;} int lcm(int a, int b) {return a*b/gcd(a,b);}
ll mul(ll a, ll b, int m) {ll ret = 0ll;while(b){if(b&1)ret+=a,ret%=m;a+=a,a%=m,b>>=1;}return ret;}
ll mul(ll a, ll b) {ll ret = 0ll;while(b){if(b&1)ret+=a;a+=a,b>>=1;}return ret;}
ll ksm(ll a, ll b, int m) {ll ret = 1ll;while(b){if (b&1) ret*=a,ret%=m;a*=a,a%=m,b>>=1;}return ret;}
ll ksm(ll a, ll b) {ll ret = 1ll;while(b){if(b&1)ret*=a;a*=a,b>>=1;}return ret;}
ll inv(ll x, int m) {return ksm(x,m-2,m);}

void run() {
  string s;
  cin >> s;
  rotate(s.begin(), s.begin()+1, s.end());
  cout << s;
}

signed main(){
//  for (tt = rd(); tt--; )
  run();
  return 0;
}


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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define fp(i,a,b) for(int i=a ; i<b ; i++)
#define fn(i,a,b) for(int i=a ; i>=b ; i--)
#define fit(i,x) for(auto i=x.begin() ; i != x.end() ; i++)
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int M=5e5+5;
const int INF=1e9;
const int MOD=1e9+7;

ll s,p;

int main(){

	fastio;
	cin >> s >> p;
	bool b = false;

	for(ll i=1; i*i <= p; i++)
		if (p % i == 0)
			if (i + (p/i) == s) b = true;

	if (b) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

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

typedef long long ll;
#define int ll
typedef pair<int,int> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
typedef pair<pi, pi> pipi;
typedef set <ll> si;
//~ typedef pair<int,pii> wtf;
typedef long double ld;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 2001
#define mp make_pair
#define INF (ll)1e18

//~ #define getchar_unlocked _getchar_nolock

int TC,N,a,b;
int A,B,C;
int ans[maxn];

void solve(){
	cin >> A >> B;
	int co = 1; int co2 = 1;
	FOR(i,1,min(A,B) - 1){
		ans[co] = co2; ans[co+1] = -co2; co2++;
		co += 2;
	}
	if (B > A){
		B -= min(A,B) - 1;
		A = 1;
		int sm = 0;
		FOR(i,1,B){
			sm += co2;
			ans[co] = -co2; co2++;
			co++;
		}
		ans[co] = sm;co++;
	}else{
		A -= min(A,B) - 1;
		B = 1;

		int sm = 0;
		FOR(i,1,A){
			sm += co2;
			ans[co] = co2; co2++;
			co++;
		}
		ans[co] = -sm;co++;
	}
	FOR(i,1,co-1) cout << ans[i] << ' ';

}
int32_t main(){
	fast;

	//~ cin >> TC;
	TC = 1;

	while (TC--) solve();

}