QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#80081#5519. Count Hamiltonian CyclesupsolveupsolveAC ✓17ms5216kbC++2016.6kb2023-02-22 01:16:082023-02-22 01:16:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-22 01:16:11]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:5216kb
  • [2023-02-22 01:16:08]
  • 提交

answer

#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=300005,INF=1<<30;

//modintのみ

// from: https://gist.github.com/yosupo06/ddd51afb727600fd95d9d8ad6c3c80c9
// (based on AtCoder STL)

#include <cassert>
#include <numeric>
#include <type_traits>

namespace atcoder {
    
    namespace internal {
        
#ifndef _MSC_VER
        template <class T>
        using is_signed_int128 =
        typename std::conditional<std::is_same<T, __int128_t>::value ||
        std::is_same<T, __int128>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using is_unsigned_int128 =
        typename std::conditional<std::is_same<T, __uint128_t>::value ||
        std::is_same<T, unsigned __int128>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using make_unsigned_int128 =
        typename std::conditional<std::is_same<T, __int128_t>::value,
        __uint128_t,
        unsigned __int128>;
        
        template <class T>
        using is_integral = typename std::conditional<std::is_integral<T>::value ||
        is_signed_int128<T>::value ||
        is_unsigned_int128<T>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                                                         std::is_signed<T>::value) ||
        is_signed_int128<T>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using is_unsigned_int =
        typename std::conditional<(is_integral<T>::value &&
                                   std::is_unsigned<T>::value) ||
        is_unsigned_int128<T>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using to_unsigned = typename std::conditional<
        is_signed_int128<T>::value,
        make_unsigned_int128<T>,
        typename std::conditional<std::is_signed<T>::value,
        std::make_unsigned<T>,
        std::common_type<T>>::type>::type;
        
#else
        
        template <class T> using is_integral = typename std::is_integral<T>;
        
        template <class T>
        using is_signed_int =
        typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using is_unsigned_int =
        typename std::conditional<is_integral<T>::value &&
        std::is_unsigned<T>::value,
        std::true_type,
        std::false_type>::type;
        
        template <class T>
        using to_unsigned = typename std::conditional<is_signed_int<T>::value,
        std::make_unsigned<T>,
        std::common_type<T>>::type;
        
#endif
        
        template <class T>
        using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;
        
        template <class T>
        using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;
        
        template <class T> using to_unsigned_t = typename to_unsigned<T>::type;
        
    }  // namespace internal
    
}  // namespace atcoder

#include <utility>

namespace atcoder {
    
    namespace internal {
        
        constexpr long long safe_mod(long long x, long long m) {
            x %= m;
            if (x < 0) x += m;
            return x;
        }
        
        struct barrett {
            unsigned int _m;
            unsigned long long im;
            
            barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}
            
            unsigned int umod() const { return _m; }
            
            unsigned int mul(unsigned int a, unsigned int b) const {
                
                unsigned long long z = a;
                z *= b;
#ifdef _MSC_VER
                unsigned long long x;
                _umul128(z, im, &x);
#else
                unsigned long long x =
                (unsigned long long)(((unsigned __int128)(z)*im) >> 64);
#endif
                unsigned int v = (unsigned int)(z - x * _m);
                if (_m <= v) v += _m;
                return v;
            }
        };
        
        constexpr long long pow_mod_constexpr(long long x, long long n, int m) {
            if (m == 1) return 0;
            unsigned int _m = (unsigned int)(m);
            unsigned long long r = 1;
            unsigned long long y = safe_mod(x, m);
            while (n) {
                if (n & 1) r = (r * y) % _m;
                y = (y * y) % _m;
                n >>= 1;
            }
            return r;
        }
        
        constexpr bool is_prime_constexpr(int n) {
            if (n <= 1) return false;
            if (n == 2 || n == 7 || n == 61) return true;
            if (n % 2 == 0) return false;
            long long d = n - 1;
            while (d % 2 == 0) d /= 2;
            for (long long a : {2, 7, 61}) {
                long long t = d;
                long long y = pow_mod_constexpr(a, t, n);
                while (t != n - 1 && y != 1 && y != n - 1) {
                    y = y * y % n;
                    t <<= 1;
                }
                if (y != n - 1 && t % 2 == 0) {
                    return false;
                }
            }
            return true;
        }
        template <int n> constexpr bool is_prime = is_prime_constexpr(n);
        
        constexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {
            a = safe_mod(a, b);
            if (a == 0) return {b, 0};
            
            long long s = b, t = a;
            long long m0 = 0, m1 = 1;
            
            while (t) {
                long long u = s / t;
                s -= t * u;
                m0 -= m1 * u;  // |m1 * u| <= |m1| * s <= b
                
                
                auto tmp = s;
                s = t;
                t = tmp;
                tmp = m0;
                m0 = m1;
                m1 = tmp;
            }
            if (m0 < 0) m0 += b / s;
            return {s, m0};
        }
        
        constexpr int primitive_root_constexpr(int m) {
            if (m == 2) return 1;
            if (m == 167772161) return 3;
            if (m == 469762049) return 3;
            if (m == 754974721) return 11;
            if (m == 998244353) return 3;
            int divs[20] = {};
            divs[0] = 2;
            int cnt = 1;
            int x = (m - 1) / 2;
            while (x % 2 == 0) x /= 2;
            for (int i = 3; (long long)(i)*i <= x; i += 2) {
                if (x % i == 0) {
                    divs[cnt++] = i;
                    while (x % i == 0) {
                        x /= i;
                    }
                }
            }
            if (x > 1) {
                divs[cnt++] = x;
            }
            for (int g = 2;; g++) {
                bool ok = true;
                for (int i = 0; i < cnt; i++) {
                    if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {
                        ok = false;
                        break;
                    }
                }
                if (ok) return g;
            }
        }
        template <int m> constexpr int primitive_root = primitive_root_constexpr(m);
        
    }  // namespace internal
    
}  // namespace atcoder

#include <cassert>
#include <numeric>
#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {
    
    namespace internal {
        
        struct modint_base {};
        struct static_modint_base : modint_base {};
        
        template <class T> using is_modint = std::is_base_of<modint_base, T>;
        template <class T> using is_modint_t = std::enable_if_t<is_modint<T>::value>;
        
    }  // namespace internal
    
    template <int m, std::enable_if_t<(1 <= m)>* = nullptr>
    struct static_modint : internal::static_modint_base {
        using mint = static_modint;
        
    public:
        static constexpr int mod() { return m; }
        static mint raw(int v) {
            mint x;
            x._v = v;
            return x;
        }
        
        static_modint() : _v(0) {}
        template <class T, internal::is_signed_int_t<T>* = nullptr>
        static_modint(T v) {
            long long x = (long long)(v % (long long)(umod()));
            if (x < 0) x += umod();
            _v = (unsigned int)(x);
        }
        template <class T, internal::is_unsigned_int_t<T>* = nullptr>
        static_modint(T v) {
            _v = (unsigned int)(v % umod());
        }
        static_modint(bool v) { _v = ((unsigned int)(v) % umod()); }
        
        unsigned int val() const { return _v; }
        
        mint& operator++() {
            _v++;
            if (_v == umod()) _v = 0;
            return *this;
        }
        mint& operator--() {
            if (_v == 0) _v = umod();
            _v--;
            return *this;
        }
        mint operator++(int) {
            mint result = *this;
            ++*this;
            return result;
        }
        mint operator--(int) {
            mint result = *this;
            --*this;
            return result;
        }
        
        mint& operator+=(const mint& rhs) {
            _v += rhs._v;
            if (_v >= umod()) _v -= umod();
            return *this;
        }
        mint& operator-=(const mint& rhs) {
            _v -= rhs._v;
            if (_v >= umod()) _v += umod();
            return *this;
        }
        mint& operator*=(const mint& rhs) {
            unsigned long long z = _v;
            z *= rhs._v;
            _v = (unsigned int)(z % umod());
            return *this;
        }
        mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }
        
        mint operator+() const { return *this; }
        mint operator-() const { return mint() - *this; }
        
        mint pow(long long n) const {
            assert(0 <= n);
            mint x = *this, r = 1;
            while (n) {
                if (n & 1) r *= x;
                x *= x;
                n >>= 1;
            }
            return r;
        }
        mint inv() const {
            if (prime) {
                assert(_v);
                return pow(umod() - 2);
            } else {
                auto eg = internal::inv_gcd(_v, m);
                assert(eg.first == 1);
                return eg.second;
            }
        }
        
        friend mint operator+(const mint& lhs, const mint& rhs) {
            return mint(lhs) += rhs;
        }
        friend mint operator-(const mint& lhs, const mint& rhs) {
            return mint(lhs) -= rhs;
        }
        friend mint operator*(const mint& lhs, const mint& rhs) {
            return mint(lhs) *= rhs;
        }
        friend mint operator/(const mint& lhs, const mint& rhs) {
            return mint(lhs) /= rhs;
        }
        friend bool operator==(const mint& lhs, const mint& rhs) {
            return lhs._v == rhs._v;
        }
        friend bool operator!=(const mint& lhs, const mint& rhs) {
            return lhs._v != rhs._v;
        }
        
    private:
        unsigned int _v;
        static constexpr unsigned int umod() { return m; }
        static constexpr bool prime = internal::is_prime<m>;
    };
    
    template <int id> struct dynamic_modint : internal::modint_base {
        using mint = dynamic_modint;
        
    public:
        static int mod() { return (int)(bt.umod()); }
        static void set_mod(int m) {
            assert(1 <= m);
            bt = internal::barrett(m);
        }
        static mint raw(int v) {
            mint x;
            x._v = v;
            return x;
        }
        
        dynamic_modint() : _v(0) {}
        template <class T, internal::is_signed_int_t<T>* = nullptr>
        dynamic_modint(T v) {
            long long x = (long long)(v % (long long)(mod()));
            if (x < 0) x += mod();
            _v = (unsigned int)(x);
        }
        template <class T, internal::is_unsigned_int_t<T>* = nullptr>
        dynamic_modint(T v) {
            _v = (unsigned int)(v % mod());
        }
        dynamic_modint(bool v) { _v = ((unsigned int)(v) % mod()); }
        
        unsigned int val() const { return _v; }
        
        mint& operator++() {
            _v++;
            if (_v == umod()) _v = 0;
            return *this;
        }
        mint& operator--() {
            if (_v == 0) _v = umod();
            _v--;
            return *this;
        }
        mint operator++(int) {
            mint result = *this;
            ++*this;
            return result;
        }
        mint operator--(int) {
            mint result = *this;
            --*this;
            return result;
        }
        
        mint& operator+=(const mint& rhs) {
            _v += rhs._v;
            if (_v >= umod()) _v -= umod();
            return *this;
        }
        mint& operator-=(const mint& rhs) {
            _v += mod() - rhs._v;
            if (_v >= umod()) _v -= umod();
            return *this;
        }
        mint& operator*=(const mint& rhs) {
            _v = bt.mul(_v, rhs._v);
            return *this;
        }
        mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }
        
        mint operator+() const { return *this; }
        mint operator-() const { return mint() - *this; }
        
        mint pow(long long n) const {
            assert(0 <= n);
            mint x = *this, r = 1;
            while (n) {
                if (n & 1) r *= x;
                x *= x;
                n >>= 1;
            }
            return r;
        }
        mint inv() const {
            auto eg = internal::inv_gcd(_v, mod());
            assert(eg.first == 1);
            return eg.second;
        }
        
        friend mint operator+(const mint& lhs, const mint& rhs) {
            return mint(lhs) += rhs;
        }
        friend mint operator-(const mint& lhs, const mint& rhs) {
            return mint(lhs) -= rhs;
        }
        friend mint operator*(const mint& lhs, const mint& rhs) {
            return mint(lhs) *= rhs;
        }
        friend mint operator/(const mint& lhs, const mint& rhs) {
            return mint(lhs) /= rhs;
        }
        friend bool operator==(const mint& lhs, const mint& rhs) {
            return lhs._v == rhs._v;
        }
        friend bool operator!=(const mint& lhs, const mint& rhs) {
            return lhs._v != rhs._v;
        }
        
    private:
        unsigned int _v;
        static internal::barrett bt;
        static unsigned int umod() { return bt.umod(); }
    };
    template <int id> internal::barrett dynamic_modint<id>::bt = 998244353;
    
    using modint998244353 = static_modint<998244353>;
    using modint1000000007 = static_modint<1000000007>;
    using modint = dynamic_modint<-1>;
    
    namespace internal {
        
        template <class T>
        using is_static_modint = std::is_base_of<internal::static_modint_base, T>;
        
        template <class T>
        using is_static_modint_t = std::enable_if_t<is_static_modint<T>::value>;
        
        template <class> struct is_dynamic_modint : public std::false_type {};
        template <int id>
        struct is_dynamic_modint<dynamic_modint<id>> : public std::true_type {};
        
        template <class T>
        using is_dynamic_modint_t = std::enable_if_t<is_dynamic_modint<T>::value>;
        
    }  // namespace internal
    
}  // namespace atcoder

using mint=atcoder::modint998244353;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int Q;cin>>Q;
    while(Q--){
        int N;cin>>N;
        string S;cin>>S;
        mint ans=1;
        
        ll sum=0;
        for(char c:S){
            if(c=='W') sum++;
            else sum--;
            if(sum==0) ans*=2;
            else ans*=abs(sum);
        }
        
        ans/=4;
        
        cout<<ans.val()<<"\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3376kb

input:

3
2
WWBB
3
WBWBWB
7
WWWWBWBBWWBBBB

output:

1
2
62208

result:

ok 3 number(s): "1 2 62208"

Test #2:

score: 0
Accepted
time: 16ms
memory: 5140kb

input:

1
1000000
BWBWBBBWWWBWBBBWBBWWWBWBBWWBWBWWWBBBBWBBWWBWBBBWBBBWWBWWBBBBWWWWBWBBWWBBWWWWBBBBWWBWWWWBBBWWBWBWWWBWWBWWBWWBWWBWWWWBWBWWWWWWBWWBWWBWBWBWBWWWBWBBBWBBBWWWBBBWBBBWBBWBWWBBBWWBWBWWWBBBBWBBBWWWBWBBBWBBWWBWBWWBBBWWWWBBWBBBWBBBBBBWBWBWBBBWBBBBBWBBBWWBWBWWBBWWWWBBBBBBBBBWBWWBBBWBWWBBBWBBBBWWBWWBWW...

output:

3254448

result:

ok 1 number(s): "3254448"

Test #3:

score: 0
Accepted
time: 7ms
memory: 5080kb

input:

1
1000000
BWBBWBBWWBBBBWWBWWWBWWBWWBBWWWBBBBBWBBBBBWBWBBBBWBBWBWBBWWWWBWWWBBBWWWBBBWWWBBBWWWBWBBBBWWBWBWBBWBWBBBWWWWBWWBWWBWWWBWBWWWWBWWBBWWBWWBBWBBBWBWBBWWBBBWWWWBBWBWBBBWWWWBWWWWWBWBWWBWWBWWBWWWWBBBBWBBWWBBBBBBBBWBBBWBBBWWBWBWWBBWBWWBWWWWBWWBBBWBWWWWWWWWBWBWWBBBWWBWWWBWWWWBWWBBBBWBBBWBBBBWWBBBBBBB...

output:

427204463

result:

ok 1 number(s): "427204463"

Test #4:

score: 0
Accepted
time: 16ms
memory: 5140kb

input:

1
1000000
BWWBBWBWBWBWWBWBBBWBBWWBWWBBBBBBWWBWWWWWWWWBWWBBWBWWBWBBWWWBBBBBBWBWBBWBWWBBWBBWBWBWBWBBBWWWBBWWWWWWBBWBWBWWWBWBWWWWBBWWBBBWBWBBWWWWWBWBBWWWBWBBWWWBWWWWBBBBBWBBWWWWBBWWWWWBBBBWBBWBBWBBBBWBWBBWWWBWBWWWWBBWBBBBBWWWWBWWBWBWBBBWBBBWBWWBWWBWWBBBBWWWBWWBWBBBWBWBBWBWBWWBBWBWBWWWBBBBWWWWWWBWBWBBBW...

output:

252592183

result:

ok 1 number(s): "252592183"

Test #5:

score: 0
Accepted
time: 10ms
memory: 5200kb

input:

1
1000000
WBBWWWBBWBBWWBBWWWBBBBBWWWBWBBBWWBWWBWBBWWWBWBWWWBWBWWBBBWBWWBWBWWWWWWWBBWBWWWBBBWWBBWBWBWWBBBBBWBWBBWWBBWBBBWWBBWBBWBBWWWWBBWWWWBWWWWWBBBBWBWWBWBBBBWWBWBBBBBWWBBWWWBBBWBWBBBWWWBBWWBBWWWBWBWWBBWWWWWWWBWBBWBBWWWWWWWBBWWBBBWBBBWWWBBBWBWBBWWWBBWBBBBWBWWWWBWWBWBBBWBWBBBBBBBBBBBBWBBWBBBBWWBBWBB...

output:

763125870

result:

ok 1 number(s): "763125870"

Test #6:

score: 0
Accepted
time: 7ms
memory: 5168kb

input:

1
1000000
BBWWBBWBWBWBBBBBBBBWBBWBWWBWWBBBWWBBWWWBBBBBBBBWWWWBWBBBBBBWWWWBBWBWBWBWBBBWBBBBBWBWBBWBWWWWWBBBWBWWBWWWWBBBBBBBWBBWBWWBBWWBBBWBWBBBWWBBWWBBWBBWBWWBBWWBWWWBWBBBWBBBBWBWWWWWWWBWBBBWWBWBWWBBWWBBWWBBBBWBBBWBWBBBBWBWWBWBBBBBWWWBBBWBBWWBBBBWBBBBBBWBWBBWWBBBBBBWBWBWBBBBWWBWBWWWBBBWBWBBBWWWBWBWWB...

output:

633319452

result:

ok 1 number(s): "633319452"

Test #7:

score: 0
Accepted
time: 16ms
memory: 5044kb

input:

1
1000000
BWBBBBBBWWBBBWWBWWBWBWBWBWWBBBWBBBWWBWBWBBWBBWWWBBWBBWWBWBWBWWBWBWWWBWBWWWWBWBWWWWWWWWBBWWWWBBBWWWWBBBWBBWBWWWWWBWWBWWBWBWBBWBWWBWWBBBBBWWBWBBBWBBBBWWWBBBBWWBWWBBBBBWWBWWBBBWBBWBBBBBBBBWBWWBWBBWWBWBWBWWBBWBWWBWBWBWWBBBWBWBBBBBBWWBWBBWBWBBBWWWWBWWBWWWBWWWWWBWBBBBWWBWWWBWBWBBBBWWWWWBWWBBBBWW...

output:

438182229

result:

ok 1 number(s): "438182229"

Test #8:

score: 0
Accepted
time: 9ms
memory: 5200kb

input:

1
1000000
WBBBWBWWBWWBWWWBWWWWWBWBBBBWBWWBBBBBWWWWBBBBBBWBWWBBBBBBWBWBBWWWBWBWBWBWBBWWWWBWWBWWWBBBBWWBBWWBBBBWBBBBWBWBWWWWBWWWWBBWBWBBBWWWWWBWBBBBBBWBBBBWWBBWBBBWBBBWWWBBBBWWBWBBBBBBWBBWWBWBBWWBBBWBBWWBBWBWBBBBWWWWBBWWWWBWWWBWWBWWWBWBWWWWWBWWWWWWBBWBWBBBWWWWWBWWBBBWWWWWWWBBBBWWBBBBBBWBBWBWWBBBWWWBWW...

output:

676362584

result:

ok 1 number(s): "676362584"

Test #9:

score: 0
Accepted
time: 15ms
memory: 5196kb

input:

1
1000000
WBWWBBWBBBBWWBBBBWWWWBWBWBBWBBBWBBWBWWWWBWBBBBBBBBWWBWWWWWWWBWWWBBBWBBWWBBWBBBBWBWWWBWBWWBWBBWBBBWBWWWWBWBBWWBWWBWBWWWBWWBBBBWWWBWBWBWBBBBBWWWWWWBWWWBBBBBBBWWWWBBWWBWWWBBBWWWBWWWWBBBWBBBBWWBBWBWBWWBWWWBWBBBWWBBWWWBBBWWWWWBWBBWBWBBWBWWBWBWWBWBWWWWBWBBBBWWWBBWBBWWWWBWWWWWBBWWBBBBWBBWWBWBWBBB...

output:

503559750

result:

ok 1 number(s): "503559750"

Test #10:

score: 0
Accepted
time: 10ms
memory: 5136kb

input:

1
1000000
BBBBBWWBBBWBWBBWWBWWBBBBWWBBBBBWWWBBBWWWBBBBWBWWWWWBBBWWBWWBBBBWWBBWBWWBBWBWBBWBBWBBWWWWWBBWBWBWWWBBBWBBBWBWWBBBBWBBBWBWBBBWBWWBWBWWWBWBWWWBBBWWBBBWWWWBBBBWBBBBBBWBWBWWBWWWBBWWWWWBWBBBWBWBBWWWWBBWBWWBBWWWBBBWWWWBWBBWBBBBWBBBBBBBBWWBBWWWBWWWWWWWWWBBWWWWBBWBWWBWWWBWWWWWWWWWWWWWBBBBBBWWBWBBBW...

output:

437353074

result:

ok 1 number(s): "437353074"

Test #11:

score: 0
Accepted
time: 10ms
memory: 5216kb

input:

1
1000000
WBWBBWBWWWWBBWWWBBBBBBBBWBBWWBBBBBBBBBWWWBBBBBWBBWWWWWBWBBWWWWBBBWWBBWWWWWBWWWWWWWWWWBWBBWWBWWWBBWBBWWWWBBWWWBWWBWBBWBWWWWBBBBWBBBWBWBWWWBBWBWWBWBWWWWWWBBBBWBWBWWWBBBWWBWBWBBBWWWBWBWWWBBWWBWWBBBBBWWBWBWWWBBWWBWBWWBBBBBBBBBBBBWWBWWWWWBBBWWBWWBWWBWWBBBWBWWWWBWWBWWBBBBBBBBBBWBWBBBWWBWBBWWWBWW...

output:

908451538

result:

ok 1 number(s): "908451538"

Test #12:

score: 0
Accepted
time: 7ms
memory: 4952kb

input:

2
500000
WWWBBWBWWBWWBBBWWWWBWWWWWBBBWWWBWBBWBBWWWWBWBBBWBWBWWWWBBWBBWWWWBBWWBBWWBBBBWWBBWBBBBBBBBBWBBWBBWWBWBWWWWWWBBWWWWBBBBWBWWBWBWWBBBBBBWBBWWWBBWBWWBWBWBWWWWWBBBBWBWWWWBBBBBWBBWBBBBWBBWWBWWWBBWWBWBBWBBWBBWWBWBBBBBBWWWWBWWWBBWBWBWBBWBWBWWWBWBWWWWBBBWBWWBWWBBBBWWWBBWBBWBBWWWWWWWBBWBBBBWBWBWBWBWWW...

output:

752071688
35785439

result:

ok 2 number(s): "752071688 35785439"

Test #13:

score: 0
Accepted
time: 9ms
memory: 4836kb

input:

2
500000
BBBBWBWWWBWWBBWWWBBBWBBWWBBBWBBBBWBBWWBWBWBWWBWBBWBBWWWWWBBWWBBBWBBWWWBBWWBWWWBBWWWWWBBWBBBWWWBWWBWWBWBBBWWBBBWBWBWWWBWWBWBWBBWBBWWBWBBBBBBBBBWBWWWWWBBWBBWBWWWWWWWWBBWWBBBWWBWBBBBWWWBBWWBBBWWBWWWWBWBBBBWWBWWWWBWWWWWBBWWWWBWBWBWWBBWBWBBWWBWWWWWBWBWWWBWWBBWWWBBBBBWWBWBWBWBBBWWBWWWBWWWBBWWBBWW...

output:

896757644
429242926

result:

ok 2 number(s): "896757644 429242926"

Test #14:

score: 0
Accepted
time: 6ms
memory: 4884kb

input:

2
500000
WWWWBBBWWBBBWBWWBBBWWBBBBBBWBWWWWWBBWWWWBBBWBWBBWWBBWBBWWWBBWWBBWBBWWBBBWWWWWBBWBBWBWWWBBWBWWWWBWBBWWWWBBBBWBWWWBBBWBBBBBBWBWBBWBBBBBWBBWBWBBBBBBBBBBBBBBWWWWWBWWBBBBWWBBBWBBWWBWWWBWWBWWWBBBWWWBBWBBBWWBBWWWWBWBWWWWWBWWBBWBWWWBWBWWWBBBBBBWWWWBWWWBBBBBWBWBBWWBWBBBWWBBWWWBWBWBWBBWWBBBWBBWBWBWBB...

output:

662272431
282998939

result:

ok 2 number(s): "662272431 282998939"

Test #15:

score: 0
Accepted
time: 16ms
memory: 4884kb

input:

2
500000
WWBBBWWBWWBBWBWWWBWBBWBBBWWWBBWBWBWBWBWWWBWBWWBBWWBWWBWWBBWBWBBBBBBWWBBWBBWBBBBWBWBWBWWWBWBBWWBBBWBBBWBBWBBWBWBBBWWBWBWBWBWBWBWBWWBBWBBWWWBBBWWWWWWBBWWWWBWWBBBWBBBBWBBBWBBBBWWWBWWWBWBBWBWBBWWBBWBWBBBWBBBBBBBBWBBBWWBBWWBBWBWWWWWBBWWBWBWWWWBWBBBBWBWWBBBBBWBWBBWBBBWBBWBWBBBBWWWWWBBBBBBBBWWBBWB...

output:

826151828
768847404

result:

ok 2 number(s): "826151828 768847404"

Test #16:

score: 0
Accepted
time: 17ms
memory: 4868kb

input:

2
500000
BWBWWBWWBBBWBWBWBBBBWBBBWBWBWWBWWBWWWWWWBWWWBBWBWBBWWBBWWBBWBBWBWBWWWWBWWBWWBBBBWBBWBBWWWWBWBWBWWBBWBBBBBWWWWBWBBWBBWWWWWBWBBBBBBWWBWWBWWWWWWBWBWWWBBBWBBBBBWBWBWBWWBWBWWBWBBWBBBBBBWBWWWBBBBWWWWBWBWWBWWBBBWWBWWWBWWWBBBBWWBWWBBWBWBWBWBWBWBWBWWWBBBWWWWBWWWWBWWBBWBBBBWWBBBBBWWBBBWBWBWBWWWWBBWWW...

output:

48287866
412612844

result:

ok 2 number(s): "48287866 412612844"

Test #17:

score: 0
Accepted
time: 5ms
memory: 4864kb

input:

2
500000
BBWWBBWWBWWWWWBBWWBBBBBBBBWBWWWBBWWBBWBWBBWWWBBBWBBBBWBBBWWWWBWBBBWWBBBBBBBWWBBBWBWWWBBBWWBBWBBBBBWBBWBWBWBWWBWWWWBWWWWBWBWWWBBWBWWWWWBBBBWWBWBWWWWBBBWWWWBBWBWWWBBBBWBBBWBWBWBWBWBBWBBWBWBBBWBBWBBWBWWBBWBBBWWWWWBWWWBWWWBWWBBBBBBWWWBWBBBBBWBWWBBWWBWBBBBWWBBBWWWWWBBBWWWBBWWBWWWWWWWWWWWWWBWBWBW...

output:

691394472
327378854

result:

ok 2 number(s): "691394472 327378854"

Test #18:

score: 0
Accepted
time: 13ms
memory: 4884kb

input:

2
500000
BBWWBWBBBBWBWBWBWBBBBWWWBWBBBBWWBBBBWWWBBBBWWBBBBBBBWWBBWWWBWWWWBWBWBBBBBWBBBWWWBWWBBBBBBWWWBBWBWBWWWBWWBWWWBWBBWBWWWWBWBWBWBBBBBWBBBWWWWBBWWBBBBWWBBWWWWBBWBBBBWWWBBWWBWBWBWWBBWBBWBBWWWBWWWBBWBWWBWBWBBWBBBBBBBBWWWBWBWBBBWWWBWBBWBWBWBWBBBBBBBWBWBWBBWWWWWBWBWBWBWBWBWWWWBBBBWBBWWBWWWWWWWWBBBBW...

output:

832099756
697519254

result:

ok 2 number(s): "832099756 697519254"

Test #19:

score: 0
Accepted
time: 7ms
memory: 4980kb

input:

2
500000
WBBBBWWWWBBBBWBWBWBBBWWBBBWBBWBBBWBWWBBBBWWBWBBBBBBWWBWWWWBBBWWBWBBBBWBBWBWBBWWWBBBBWBWWWWBBWBBWWWWWWWBBBBBWWWWBBBWBWBWBBBBBBWWBWWWBBBWWBBWBWWBWWBBWBBWWBWWWBBBBBWBBWBWWBWBWBWBWBWBBBBBBBBWBWBBWWWWWWBBWWWWBBWWWWBBBBWBBWWWWBWBBWWWWWWWWBWWWWWWWBWWWWBWBBBWBBBBWWBWBWWWBWBBBWBWBWBWBWWWWWBBBWWWWWBB...

output:

263460180
38222788

result:

ok 2 number(s): "263460180 38222788"

Test #20:

score: 0
Accepted
time: 6ms
memory: 4888kb

input:

2
500000
BWWWWWWBWBWWBBBWWWBBBBWBWBBWWWWWBWBWBWWBBBBWWBBWWBWWWBBWBBWBBBBBWBBBBBWWBBBBBBWBWBWBBBBBWBWBWWBBWBWWBWBWBWWWBBWWBWBBWWWWBWBWBBWWWBWWBWBBBWWBBWWWBBBWBWWWBBWWWWWWBWWWWWBBBWWBWWBWWWWWBWBWWWWBBBBBBWBBBBBBWWBBBBBBBWBBWBBBWWBWWWWWBBWWBBWWBBWBBBBBWWWWWBBBWWBWBWBWBWBBBWBBWWBWWWBWBWWBBWBWWWWWBBWBWBB...

output:

306109747
906397783

result:

ok 2 number(s): "306109747 906397783"

Test #21:

score: 0
Accepted
time: 11ms
memory: 4888kb

input:

2
500000
WWBWBWBWWBBWBBWBWWWWWBWWBWWBWWWWWBBWBWBWBWBWBBBWBWWWWBBWBWBWWBBWWBWWBWWBWBWBWWWWBBWBBBWWWBBBBBWWBWBWWBBWWBWWBBBBBBBWWWWBBBWBWWBBWWWWBBWBWBBBBWWBWWWWBBBBBWBBWBBBWWWBWWBWWBWWWBBBBWBBWWWBBBWBWBWWWWWBWBBBWWBWWBWWBBWBWWWBBBBWBWBWBBBBWBWWWWBWBWBWBWWWWWWBWWWBBWBWBBWBWWBBWBWWWWBWWWWWWBBBBWWWWWBWWBB...

output:

449051027
367066223

result:

ok 2 number(s): "449051027 367066223"

Test #22:

score: 0
Accepted
time: 5ms
memory: 3896kb

input:

10
100000
WBBWWWBBBWBBBBWBWBBBWWBWBBWBWBWWWWBBWBWWWWWWWWBWWWBWWWWBBWWBWBWBBWBBBWBBWWWWWWWWWWWBBWBBWBBBBBBBBWBBWBBWWWWWBBWBBWWBWWBBBWWWBBWBBBWWBWWBWBWBBBBWWBBBWWWBWWBBWBWWBWBBBBWBBBWBWWBWWBBWBWBWWWWWBWWWBWBBBWBBBWBBBWBWBBBWWWBWWBBBBWWWBWWBBBBBWBBWWBWBBBBBWBBBBBBBWBWWBWBBBBBWWWBWWBBBBWWWBBBBWBBBWBBBBW...

output:

840200670
669203650
573016869
831948208
348091728
629012531
525775465
766624567
890512510
257057519

result:

ok 10 numbers

Test #23:

score: 0
Accepted
time: 16ms
memory: 3924kb

input:

10
100000
BBBWWBBBWWBBBWBWBBWWWBBBWBWBBBWWWBBBWBWBWBBWBWBBWWBBBBWBBBWWWBWWBWBBBBWBWWWBBBBBWWBWBBWBWWWBBWWWBBWWBBBWWBBBWBBWWBWWBWWBBBWWBWBWBWBWBBWBWWBBWWBWWBBBWBBBBBWWWBBBBBBWWBWWBWWBWBWBWBBWBWWWWWBWWBBBWWWWWBWWWBBWWBWWWBWBWWWBWBWBWBWWWBBBBBWBBWWBWWBBWWBWWBWWWBWBBWBBBBWWWBWWBBBBWBBWBBBBBBWWWBBBWBWWWW...

output:

739376022
791207650
5043011
711675482
984222635
656910033
292721947
996580870
166966617
713366788

result:

ok 10 numbers

Test #24:

score: 0
Accepted
time: 15ms
memory: 3860kb

input:

10
100000
BWBWBBWWWWWBWWBBWBBWWBBWWWWWWBWBBBWBWWWWBWWWBWWBBBBWWBWWWBBBBWBWBWBBBBWBBWBBBWBWWBBBWWWBBWWBWWWWBWBWWBWBWWBBBBBWBBWBWWBWWBBWWWBBWWWWWBWBWWWWWBWWBWBWWWWWBBBBBWBWWWBBBWBWBWBBBBWWBWWBWBWBBBBWWWWWWWWBWWBWBWWBBWBWBBBWBWBBWBWBBBBWBWWWBWBBWWBWBWWWBBBWBBWBWWBWBWWBWWBBBWBWWWWWWWWWBBWWBWBBWWWWBBWBBB...

output:

705571747
347114451
4034697
935303588
574105135
180947021
134617773
329752078
810877083
859208614

result:

ok 10 numbers

Test #25:

score: 0
Accepted
time: 10ms
memory: 3912kb

input:

10
100000
WWWWBWWWWWBBBWWBBBWBWWBBWBBBBWBBWBBWWBBWBWBWWBBWBWBBBBBWWBBBWBBWBBWWWBBBBWBBWWBWBBWWWBWBWWBWWWBWWWWWWBBBBWWWWBWBWBBWWWWBWBWBBWBBWWBBWWWBBWWBBBWWBBWWWWBWBBBWWBWBBBBWBWWWWWWWBWWWBBWBBBBBWWBWBWBWWWWWWWBWBWBBBBBWWBBBWBBWWBWBWBWWWBWBBWWWWBWBWWBBWWWBBBWWWWWWBWBWBBBBBWWWBWWWWBBBBBBBBWBBWBBBWWBWBB...

output:

301724941
667227915
761147395
864311019
175341365
415857493
265639703
4546687
644558520
945345127

result:

ok 10 numbers

Test #26:

score: 0
Accepted
time: 11ms
memory: 3900kb

input:

10
100000
WWWWWBWWBBWWWWBWBWWBBWBWBWWBWBWWWWBBWBWWBBBWBBWBWBWWWWWBWBWBBBWBWWWBWWBWBWWWWWWBWBWWBBWWWWWBBBWBWWWBBBBWWBBBBBWWWWBBBWBWWWWWBBWBWBBWBBBWWWBBWWBWBWWBBBBBBWWWBWWWWBBBBWBWBBWWBBBBWBWBBWBWBWBWWBWWWBWBWWBWWBWBBBBWWBWWBBWBWWWWBWWBBWWWWBBWWWBBWWBBWWBBWBWBWBBBWWBBWBBWBWWWWBBWBWBWBBBWWWBWWWBBBWBWBB...

output:

127116448
391944765
777767336
666271086
37616595
119397373
60777574
842161390
537232470
296748002

result:

ok 10 numbers

Test #27:

score: 0
Accepted
time: 12ms
memory: 3884kb

input:

10
100000
BWWWWWBBWWBWBWBWWBWWBBWWWBBBWBWWBWWBWWWBWWBWWBWWWBBWWBBBBBBWWBWBBBWBWWBWBWBBWBWBBWWBBWWBBBWWWWWWBWBBBWWWBWWBWWBWBBWBBBBWWWBBWBBWWWWWBWBWWWBBWBWBBWBWBWWBBWWWWWWWBBWBWBBBWBWBWBBBBBWBWBBBWBWWBBBBBWWBBBBWWWBWBWBWWWWBBWWBWWBBWBWBWBBWBBBWBBBWWWWBBBBBBWBBBBBWWBBWWWWWWBBBBWBBWWWWWBBWWWBBBWBWBWBWBB...

output:

710829593
286160844
153706549
800436307
296362777
800512861
890624110
345691652
156664695
781826087

result:

ok 10 numbers

Test #28:

score: 0
Accepted
time: 14ms
memory: 4020kb

input:

10
100000
WBBBBWBBBWWBWBWBWBWBBBBWBBWBBBWWBBBBWWBWBWBBBWBWWWBWBWBWBWBWBBBBBWBBBBWWWWBWWWBWBBWWWBWBWWBWWWBWWBWWWWWWWWBBBBWWWWBWWBWBBWWBBBBBWBBWBWBBWWBBWWBBWWBBBBBWBBBWWBBBWWWBBBWWWBWWWWBWWBBBWBBWBWBWWBWWWBWBWWBWWWBWWBWBBWBWBBBBBBWWWBWWBBBBBWBBBWBWBBWWBBWWWBWWWBBWBWBBBWWBWBBBWWWWWBBWWWBWWWWBWBBWBBWBWW...

output:

539605066
782369726
763241154
782487645
853433135
737103993
122184423
36756376
272929500
235505573

result:

ok 10 numbers

Test #29:

score: 0
Accepted
time: 9ms
memory: 3944kb

input:

10
100000
WWWWBBWBWBBBBBWWBWBWWWBBBWWBWWBBWWWBWWBWBWWWBBBBBWWBBBWBBWWBBBWBBWWBWWBBBBBBWBBBWBBWBWWWWWBWBBWWWWBBWWWBBWBBWWWBBWWBWWWWWBWBWBWWBBBWWBBWBWWWBWWBWBBWWWBWBWWWBBBWBBBBWBWBWBWWBWBWWWBWBWWBWWWWBBBBBBBBWBWWWWBBBWWWBBBBBWBBWWWWWBWBBBBBBWBBWWBBWWBWWWWWWBWBWBBWBBBWBBWWBWWBBBBBBWWBBWWBBWWBWWWBWBBWWB...

output:

338631687
559627947
287029471
52015427
80526833
324264919
817018503
297383562
882505968
130642758

result:

ok 10 numbers

Test #30:

score: 0
Accepted
time: 14ms
memory: 3944kb

input:

10
100000
WBWWBBWWWBBWBBBBBBWBWBBWWBWBWWBWWBBWWBWBBBBWWBWWBWBBWBBWBBWWWBBBBBWWWBWBBWWBWBBWWBWBWWBWBWWBWWBBBWBBBWWWWBWWWBWWBWBWWWBBWBBWWWWBBBBWWBWWBBWBWWBBWWBBBWBBBWBBBWWBBWBWWWBWBBBWWWWWBBBBWBBBBWWBBWWBWWBBWWWWBBWWBBBWWBWWBBBBBWBWBWWBWWBBBWBWWWWWWWBBWWWWWBWBBBBBBWWBBBBWBWBWWWBWWWWWBBBBWBBBWBWBWBBBWB...

output:

644552191
746807558
381589972
258060514
375070458
124706860
880338672
512283162
230528645
299616431

result:

ok 10 numbers

Test #31:

score: 0
Accepted
time: 11ms
memory: 3944kb

input:

10
100000
WBWBWBBBWWWWWWBWBBBWWWBWBWBWBWBBWWWBWWBWWWBWWWBWWBWWBWWWWBBBWBWBWWBBBWBBBBBBWWBWWBBBBBWBBBWWWBWWWWWWWWBBWBBBBWBBBWWBBBBBWWBWBBBBBWWBBWBBWWBBWBWBBWWWWWWWWBBWWWBWBWBWBWBBWBWBBBBWWBWWBBBWWWWBWWWWWWBBWBBBBWWWBWBBWWWBBBWBBWWWBWBBBWWWBWWBBWWWBBWBWWBBBWWWWWBWWBWBBWWBBWWWWWWWWBWWBWBWBWWBBBWBBWBBBB...

output:

505100198
101705031
536231041
605191433
81101040
865064746
457110559
106550226
267795829
212787085

result:

ok 10 numbers

Test #32:

score: 0
Accepted
time: 10ms
memory: 3612kb

input:

50
20000
BWWBWWWBWWWWBBBWWBBWBWWBBBBBWWWWBWBWBBBWWBWBBBWBWBBWWBWWWWWBBWBBBWWBWWBWBBWWBWWBWBBWBWBWBWWBBWWBBBBBWBWWBWWBBWBWWBWBWBWBWWBWBWWWWWWBBWBWWWBWBBBWBWBWBBBBWWWBBWBWBBBBBWWBWWBWBWWWWWBBWWBWBWBBWBWWBBBBWWWBBBBWBBBWBBBBWBWBWBWWWWBBBWBBWBBBWWWBBWWBBWWBWWWBWBWBWWBWBBBWWBBBWWWWBWWWWWWWBWBWWBBWBWBWBBB...

output:

459660612
782112465
715104847
570113528
724186299
793048485
698601807
383177677
914359682
818419867
213829962
808230667
94600781
9566985
542012727
838030141
50815299
545551738
764851463
403074192
370053011
65092431
704878367
165585096
737303431
948219756
254868133
908061042
586655359
964096652
27064...

result:

ok 50 numbers

Test #33:

score: 0
Accepted
time: 9ms
memory: 3488kb

input:

50
20000
BBWWBWBBWBWWWWBWBWWBWBWBBWBBBBWWWWBWBBWBBWWBBBWBBBBWBBBBWBWWWWBWBBWWBBWWWWWWWBWWBBWBWWWWWWBBWWWWBBWBBBWWWBBBBWWWWWBBWBWWBWBBBWBBBBBWBWWBWBWWWBWBWWWWBWBWBBWWBBBBBBWWBWWWWWBWBWBBBWWBWWWBBWBBWWBWWBBBWWBBBWBWBBBWWBWBWBBWWWWBWWBWBBBBWWBBBBBWBBWBWWWBWWBWWBWWBBBWBBWBBWBWBWBBWWWBWBWBBBBWWBWBBWWBBWB...

output:

421532049
354080607
254418732
568110939
979875462
746131130
201805432
902401396
696275154
61685879
788535782
954441840
613115993
243242858
395281823
666311821
275366417
698729322
553483405
356630660
239996303
828034383
321452708
633383949
662204404
87083428
950641761
599041249
297785991
274595563
47...

result:

ok 50 numbers

Test #34:

score: 0
Accepted
time: 7ms
memory: 3516kb

input:

50
20000
WBBBWBBWWWWWBBBWWWWBBBWWBBWBBBBWBBBWBBWWBWBBWWWWBBBWWWBWBBBWBBWWWBWBBWWBBBWBBWBBBBBWBBWBWWWBBBBWWBBBBWBWWBBBWBBWBBBBBBWWWWWWBWBWWBBBBBBWBWBBBBWWWBWWWBBBBBBWWBWWWBWWBBWBWWWWBBBBBWWWWBWBBBBBBWBBWBWBWWBWWBBWBBBWBBBWBWBWBWBBWWBWWWBBBBWBWWBWWBBBWWBBWBBWBWWBBWWBBWWBBWBWBBBBWWBWBBWWBBWBWBWWWWWBWBB...

output:

282087325
79060563
182426515
221482032
152642197
533145720
343304987
733432872
32313437
500077009
692731570
960372393
892858124
627321274
673735613
870706320
989250889
95001143
365786618
857428143
602740012
506808751
435060175
164974912
910743544
279215057
206455969
829171435
928030038
17796761
5678...

result:

ok 50 numbers

Test #35:

score: 0
Accepted
time: 8ms
memory: 3532kb

input:

50
20000
BBWWWBWBBWWWBWBBBWWBBBBWWWWBWWWWBWWWBBWWWBBWWBWBWWWBBBBWWWWWWWBWWBBWBWBBWWWBWBBBBBWWBWWBBBBBWBBWBBWBWWWBWBBWWBBWBWWBBBWWBWWWBBWWBBBBWBBWBWWBBWWWWWBBBWWBBWWWBBBWWWWWBWWWWWBBWBWWWWBBWWWBBBWBWWWBBBBBBWWWBBBBWBWBBWBWWBWWBBWBBBWBBWBBBBBWWBBBWWBWBBBWWBBWBWBBWBWWWWWWWBWBBBWBWBWWWWBBWWBBBWBWWWWBWBB...

output:

943730552
830778095
618526381
574159003
910652307
898430274
287207464
945037158
914268614
310754022
111757834
325181153
589041135
63508417
49284066
238203506
442084663
208345276
907890178
109704403
125562909
14024190
939068367
629670597
855542811
120222912
976457907
167931211
609398118
399910320
154...

result:

ok 50 numbers

Test #36:

score: 0
Accepted
time: 10ms
memory: 3508kb

input:

50
20000
WWWWWWWBWWBBBBWBBWWWBWWBBBWWWWBWWBBBBWBBBBWBWWBWWWWBWWWBBBBBBBWWWWBWBBWBBWBBWWWWBBWBBBWWBWWWWBBWBBWBBBWWWBWBBBWBBBBBBWWWBBBWWWBWWWWWBWWBWBBWBBWWWWWBWBBBBWWBWWBWBWWBWBBWBWWWWBWWBBBWBWBBBWWBWWWWBWWWWWWWBBWBBBWWBBWBBBBWWWWBWWBBWBBBBBBWWWWBBWWBWBBWWWBWBBBWWBWWWWBWBWBWWWWBBBBBBWWBBBBBWBWBBBBWWBB...

output:

350630119
911510784
853375889
631437803
803053512
486984691
268323357
458482742
320104635
643525171
473980313
289904988
921120703
508488007
919943137
62533392
750580153
897153542
477817451
927644480
751716875
773373868
305752793
688497298
671741797
893088224
161510058
601764647
707414873
854983251
6...

result:

ok 50 numbers

Test #37:

score: 0
Accepted
time: 6ms
memory: 3488kb

input:

50
20000
BWBBWBWBBWWBWWBBWBWWWBWBWWBWWWWWWWWWWWBWBBWWWBWWBWBBWWWWBWWWWBBWWWBBBBBWWBWWBBWBBBWWBWBWBBBWWWBWBWBWWWBBWBBWBWBWWWWBBBWBBWWBBBBBWWWWBWBWWWBBBBWWWBBWBBWWBWWWBWWWWWWWWBWBBWBBBBBWWBBWWWWBWWWBWBWBBWBBWWBWWBBWWWBWWWWWWBWBBWWBWWBBBBWBBBWWWWWWBBBBBBBBBBBWBBWBBBWBBBWWWWBWBWBWBWBWBWBWBBBWWWBWWWBWWWB...

output:

27102134
539019560
441834983
648377225
343384002
632703542
607650308
994372427
7693682
809209416
569570873
25273300
225032906
165552235
889840326
782437293
732313711
974587391
368698423
308128496
520507505
879974476
468587240
749140150
31665841
305689716
143439433
861274155
89563713
387646612
253096...

result:

ok 50 numbers

Test #38:

score: 0
Accepted
time: 7ms
memory: 3492kb

input:

50
20000
WBWWBBBWBBWWBWBBWBBWBBWBBWBBWBWBBWWWBWWWBBWWWBWBBWBWBBBBBBWBWBBBBWWWBBBWBBWWBWWWWWWWWWWWBWBBBBBWBBBBWBWWBWWBBWBBWWWBWWWBWWBBWWWBWWWBBWBBBBBWWWBWWWBWBWBWBBWBWBWBWBWBBBBBBBWBWBBWBWWBWWBBWBWBBBWWBWWBBBBWBWBWWBWWBBWBBWBWWBWWWWBBBBWBBBBBWBWBBBWWWBBWWBWBBBWBBWBWWWBBWBWWBWBBWWWBWBBBWWWBWBWBWWBBBWB...

output:

808808941
102272777
641693798
125497176
168234826
787182076
257423028
871033962
681878214
925472125
784659695
931784983
79284097
345094198
258252895
612900703
672597016
812416190
361197711
159645699
633287298
161216504
755102339
223476644
830592561
404203986
665209248
449650486
533457118
554184937
7...

result:

ok 50 numbers

Test #39:

score: 0
Accepted
time: 9ms
memory: 3516kb

input:

50
20000
WBBBWBBWBWWWBWWWWBBBBWWWBBWBBBWBWBWBWWBBWBBWBBBBBBWWBBWBBWBWWWBBBWWBBWBBBWBBBBBWWBWBBBBWWWWBWWWBBBWBBWBWWWBBWBWBWBBWWWWWWBWWBBBBWBWBWBBWWWWBBWWBBWBWBWWBWWBWWWWWWBBWWBWWWWWWWBWWBBBWWWWBWBBWWBWBWBBBBBWBWBBBWBBWWBBBBWWBWWBBWBWWWBWBWBWWWBWWWBBBWWWWBWBWBWWBWWBWBBBWWBWBBWBWWWWWWWWBBBWBWBWBBBBWBWW...

output:

243470478
401423195
478961933
891665169
441957585
458473404
744205937
954353630
345112178
612690455
845868752
231026193
740043852
751509406
845205473
953658013
76676452
262562309
761536090
451400841
344773744
192704209
437233437
909262386
961959401
567072057
627781223
200364151
883899461
248900821
3...

result:

ok 50 numbers

Test #40:

score: 0
Accepted
time: 10ms
memory: 3488kb

input:

50
20000
WWWBWWBWWBWBWBBBWBWBWWWWWBBBWWBBBWWBWWWWBWWWBWBWWWWWBBBWWWWWBWWBBBBWBWBBBWBBWWBWBBWBBWWBBBBWBBBWBBWWBWWWWBBWBBBBWBBWBBWBWWWBBWBBWBWWWBWBWBWBWWWWBWBBBBWWBWBWWWBBWWWWWWBBBBBWWBWBWWWBWWWWWBBWBBWWWBBBWBWBBBBBWBBBBWWWBBBBWBBBWBWBBWWWBWBWWWBWBBBBBBBWBWWWBBBWBWBBWWWBBBWBWWWWBWWBBBWWWWWWBWBWBWBWWBW...

output:

797564833
399032562
660658352
60111807
601971896
338375386
191129421
72826527
503064508
504301247
918706044
24757679
340127860
172540633
905196518
692056141
943157176
29963457
589277263
681824426
100770630
832059619
501328905
70956978
788477279
772683675
924832656
348167778
854098566
332460839
81886...

result:

ok 50 numbers

Test #41:

score: 0
Accepted
time: 14ms
memory: 3508kb

input:

50
20000
WBBBBWBBBWWWWBWWBBWWBBWWBWBWBWWWBWBBWWBBWBBWBWWWWBWBWBWBWWBWBWBWWWBWWWBWBWWWBBBWWWWWBBWBWBBBWWWWBBWBBBWWBBWWBBWBWBBBWWBBBWWBBWWBWWWWBBWBBBWBBBBBWBBBWBBWBBWBWWWWBWWWBWWBWWWWWBWBBWWWBBWWBWBBWWWBBWWWWWBBBBBWBWWBWWBWWWBWBWBWWBBWBBWWWWBBBWWWBWWWWBWWWWBBWBWWBBBWBBWBBWBBWBWBBBWBBBBBWBBWBBWWBBBWWWW...

output:

820532914
24850706
463253969
119099704
388841233
260673963
384943948
916791236
738967190
180472161
127011541
802845376
511734560
73842303
568372579
819302093
455197375
557458549
139005313
966027752
669721394
609439971
203894534
428049159
666776023
731041742
108675871
579116435
792736312
49422985
705...

result:

ok 50 numbers

Test #42:

score: 0
Accepted
time: 7ms
memory: 3424kb

input:

100
10000
WBWBWWWWBWBWWWWBBBWWWBWWWBBBBWWBWWWBWBWBBBWWBWBBBWBBBBBWBBBWWWWWBWBBBWBBWBWWWBWBWWWBBBWWWBBBWWBBBWBWBWBWWBWWBBBBWWBBWWWWBBBWWBWWWWWBWWBWBBWBBWBWWWWBBWBWWBWWBWWBBWBWWWBBWWWWWWWBWWBWWWBWBWWWBBBWWWWWWBWBWBBBBWWBBWWBBWBWWBBBBWBWWBBWWBWBBWWWWWWBBBBWBBBWWWBBWWBWWBWWWWBWBWBWWBWWWWBWWBBBBWBBBBWWWB...

output:

65473238
242831624
558903165
100016115
659803230
666349002
806802370
381928254
865650412
590215502
676886059
318052692
512456341
165817502
612252013
69801372
871969570
252534521
108073998
609075483
730689906
263455803
326492842
604449676
776942269
343408465
147850533
576668168
255078778
597968276
30...

result:

ok 100 numbers

Test #43:

score: 0
Accepted
time: 8ms
memory: 3556kb

input:

100
10000
WBBBBWBBBWBWBBWWWWBWBWBWBWBWBWBBWBWBBBWWBWBWWWWWWWWWBBBBWWWWBBBWBWWWWBWBBWWBBWBWBBWBBBWBBWBWWWBWBBWBBWWWBWBBWBWWWBBBWWBWBBWWBBBWBWBWBBBWBWBWBBBBBWBWBBWBWWWWBBWWBBWWBWBWBBBWWBBBBWBBWWWBBWBWWBWWWWWBWWBWBWBBWWBBBBBWBBBBWWWWBBBWBWWBWBWWBBWWBBBWBWBWWWBBWBWWBBBBBBWBBBWBBWBBBWWWWWWBWWWBBWBWWBBBWB...

output:

73363593
83119864
954176406
521083540
202395351
553308321
949468519
640092395
170647834
868692028
81877615
412000791
884144601
818570071
396289520
158702665
556530624
41711514
323834585
556567891
925145005
708958926
485472297
914361438
497161127
468449248
441463689
377458009
24805681
516712548
32498...

result:

ok 100 numbers

Test #44:

score: 0
Accepted
time: 3ms
memory: 3448kb

input:

100
10000
WWBWBWBBBBBWWWWBBWWWBWBBWWWBWBBBBWWWBBBWBBWWWBWWBBBBWWBWWBWBWBWBWBWBWWBBWWBWBBWBWWWBBWWBWBBBBWBWBWWBWBWBBBWBBBWWWWWBWWWWBWWWWWWBBBBBBBBWBWBWWBBBBWWWWBBWWWBWWWBBBBBBBBWWWBWWBBWWBWWBBWWWBBBWWWWBWWBWWBWBBBWBBBBBWBBBWWWBWWBWWBBBWBBBWWWWWBBBBWWBWBBWWBWBBBBBBWWWBBBWWWWBWBBWBWWWWWWWWBWWWBWBWBWWBB...

output:

115013370
601012279
714091436
202133372
374331139
883967536
298884406
315727203
630216845
248592968
920480239
9471487
497222677
674166313
27113066
364775341
427984625
87603226
6658975
605674452
902548466
809529271
701744948
754998061
545756031
438015849
959436605
799853258
268992724
53646559
4706940...

result:

ok 100 numbers

Test #45:

score: 0
Accepted
time: 14ms
memory: 3500kb

input:

100
10000
BBWWBBBWBBBBBBWWBWWWWBBBWWWBWWWWBBWBWBBWWWBWBBWBBBBWWBBBWBBWWWWBBBWBWBWBWBWBWWWWWWWWWWWBWBWWBWBWBBWBWBBBBBBWBWBBWWBWWWBWWBWWBBBWBWWWBBWBBWWBBWWBBWBWBWBWBBWBWBBWWWBBWBWWWWBWWBBBWWWBBWBWWBBBWBBWBWWBWBBWBWBWWBWBBWBWBWWWWWWBWBBWWBBBBWWWBBBWWWBWBWBWWBWBWBBBBWBWWBBWWBBWBBBBWWBWWBBWBBWBWBBWBWBBBW...

output:

733576480
752378674
19449242
311057812
275561215
194981284
142185943
125608161
507660946
550663297
182132836
34378228
657917903
65367492
646960827
676881538
34994487
505929750
332927850
29034906
882657205
358842736
935985774
93362292
354823191
874644750
965739834
81043854
931480793
669654894
5089325...

result:

ok 100 numbers

Test #46:

score: 0
Accepted
time: 9ms
memory: 3452kb

input:

100
10000
WBBWWBBWBBWWBWBWBWBWWBWBBBBBBWBBWWBWWBBBBWWWBBWWWWWBBBWWWBWWBBWBBWBWWBBWBBBBWBWWBBBBBBWWBBWWBWBBBWWWWBBBWWWBWBBBBBWBWBBBWWBWBBBWBWWBBBBWWWWBBBWBWWWBWWBWBBBBWWWBBWBWBBWWBWWBBWBBWWBWBWBBWWWBWBWBWWBBWBWBWBWWWWBBBBWBWWWBWBBBWBBWBWWBWBBBWWWWWBBWWBBBBBBBWBWBBWWBBBWBWWBBWWBBWWBBBWWWBWWWBBWWBBBBBW...

output:

282251465
682158370
171477091
90627483
993888940
672145025
954260559
975286333
829285537
842710728
49905388
188025434
488300524
233616022
764261688
388674414
635219514
339499370
438836251
367185815
663929987
267794557
806349840
449858865
213220291
714224913
885709361
443738498
398995035
396918486
18...

result:

ok 100 numbers

Test #47:

score: 0
Accepted
time: 13ms
memory: 3520kb

input:

100
10000
BBWWWBBWBWWBWBBBWBBWWWBWBWWBWBWBBWBBWWWBWBWBBBBBWBBBBWBBWBWWWWWBBBWBWBBWBBBWWBBWWWBBBBWWBWWBWBBWBWBBBBWWBWBWBWWWBWBBBWWBWBBBWWBBWWWWWBBBWBBBWWWBBBWWWBBBBBWBWBWWBWBBBBWBWWWWWWBBBBBBWBWBWBWWBWWWWWBWWBBBBWWBBWBBBBBWWBWBWBBWWWBBBBWBBBBBBBWWWBWBBBWBWWBWBWWBWBWWWBWWWWBBBWWWWBWWWWWBWWWBWBWWWWBBBW...

output:

228212090
831638389
391977479
917138385
809637148
780133300
932325737
257182804
797835997
498551007
13406049
796036576
612674721
413198942
650437756
144395313
891858455
38561902
768723961
531621500
488919659
991237498
936051791
722275522
779007227
278089032
186743686
875302881
819454538
811298392
92...

result:

ok 100 numbers

Test #48:

score: 0
Accepted
time: 6ms
memory: 3556kb

input:

100
10000
BWBBWBWBWWWBWWBBBBWWWBBBBBBWWBBWBBWWWWWBBWWBWWWBBWWWBWBWBBWBBBWBWBWWWWBBBBBWBBBBWBBWBWBBWBBWWWWWWBWBBBWWBWBWWWWWBWBWBWBWWWWWBWWWWBBBWBWBBWBBBWBBWBWWBBBWBWWWWBWBWWWBWWBWBBBWWWWBWWBWBWBWBBBWBWWBBBBBWWBBWBWWWWWBBBWWBBWWWBWWWBBWBWWWBBBWBWBBBWWBBBBBBWWBWBWWBBBBBWBWBBWBWBWBBWBWBWWBWBBWWBWBBBBBBW...

output:

880935090
392538216
757990297
444273168
239943775
552799914
166877391
932900545
124949004
310561184
210375139
412148
131161759
799923762
206456046
252886667
617903152
946950993
374336537
676062716
692085913
541239864
779698985
762145380
37152237
8159797
916975290
81022287
61055655
735977140
61828996...

result:

ok 100 numbers

Test #49:

score: 0
Accepted
time: 14ms
memory: 3580kb

input:

100
10000
WBWBBBBWBWWBBWWWBBWBWBWBWWBWBWWBWWBWBWWBBWBWWWBBWWBBWWBWWBBBBBBWWBBWBWBWWBBWBWWWWBWBWWWBWBBWBWWWBWWWBBWBBBWBBBWBBWWWBBBWBBWWBBWBWBBBBWWWWBBWBBWBWWWBWWBBWWBBBWWBWWWWWBWBWWWWBBBBWBBBWWBBWWBWWBWWBBBWWWWWWWWBBBBBWWBWBWBBWWBBWBWWBBWWBWBWWBWBWBWBBBBBWBBBWWBWWBWBBWWBWWWBWWBWBWBBWBBBWBBBWWBWBBBBWB...

output:

4780293
832578462
444833041
74090640
857714203
974521018
871103095
978538073
459459361
285107538
430212557
385627778
724272454
714370479
743988260
679339099
963130038
974755543
122681871
759502852
741358267
602140576
809564379
186810944
750954297
663066386
415865006
350030293
98845456
451979896
5213...

result:

ok 100 numbers

Test #50:

score: 0
Accepted
time: 16ms
memory: 3504kb

input:

100
10000
WBBWBBWWWBBBWWWBBBWBWWWBBWBBWBWBBBWBWWWWWWWBBWBWBBWBWWBBWBWWBWBWWBBBWWWWWWWWBWBWWBWBBWBBBWBBWWBBWBWBWWWWWBBBBBBWWWBBWWBBWBBWBBWBBBWBBBBBWBBBWWBBBBWWBWBWBBWBBBBWBBWWWWWBWBBBWBWBBBWBBWBBBBWWWBWWWBBWBBBBWBWBBWWWBWBWBWBBBWBWWWBWBBBWWBBWBBWWBBBWBBWWWWBBBWBBBWWBBBWBWBWWWBBBWBBWBBWBWBWWBBWWWBWBBW...

output:

678135780
856931588
355824589
120798804
756110773
989997872
208394653
167868733
591279832
621765109
90030628
431256317
484290275
883117009
783268292
837336452
537376166
960466033
333888355
144378142
658211160
97455394
531229655
144766560
248098351
769496358
797884467
301552085
910156999
837071072
28...

result:

ok 100 numbers

Test #51:

score: 0
Accepted
time: 8ms
memory: 3468kb

input:

100
10000
BWBWWBWBBBBBWWBBBBWBWWBWWWWWWWBBBBBWBBWBWWBWBBBWWWWBBWWWBWWBBBBBBBBWBWWBWBBBBWBWWBBBBWBWWBBWBBBWBBBWWBWWBWWWBBBWBWBBWWWWBBBBWBBWBBBWBWBWWBWBWWWWWWWBBWBBBBBBBWWWBWWBBWBBBWBBBWBBBWWWBWBWBWWWWBWWWWWWBBWBWWWWWBBWWBBWBBBWWBWWBWBBWBWWWWWBWBBWBWWBWWWBWWBBWBBBWBWBWBWBWBWWBBBBBWWWBBWWBWBWWWBWBBBWBB...

output:

763885099
977650344
860449889
464982488
398857484
980649689
267547434
884821240
130112299
100146592
482915912
167197065
689858176
833736415
27008962
795391937
745808690
558354412
45489464
515893960
308117731
678102670
963327799
214357414
391528162
635545258
440283326
693829584
459498670
913064607
43...

result:

ok 100 numbers

Test #52:

score: 0
Accepted
time: 7ms
memory: 3456kb

input:

1000
1000
WBBWWBWWWBWWBBBWBBBWBWBBWBBWWBWWBBBBWWBWBWBWBBWBWBWWWBWWWBWBBBWBWWWWWWBWBBWBBBWWBBBBBWBWWBBWWWBBBBWBWWWWBWBWBWBWBWWWWBWBWWBBWWBBBBBBBBBWBBWWBBBWBBWWWBWWBWWWBBWBWWBWWBBWWWBBWWBWWBBBBWWBBWBBBWWBWWWWBBWWWBWWBWWBBBWBBWBBWBWWWBBWWWWWWBBWWBBBBBWBWWBBWBBWWBWBWWWBWBBBWBBBWBBBWWBWWWBBWWWWBBWBBBBWBW...

output:

768342539
110012628
81597472
677391934
513451160
177326612
560427983
92441325
226791327
405508751
764693947
297147099
201024194
400487022
315026895
244977741
501395903
318387263
288093271
549935722
580942627
225503664
955951307
87802189
664550504
170555154
844277964
752917963
849028832
995978971
542...

result:

ok 1000 numbers

Test #53:

score: 0
Accepted
time: 6ms
memory: 3412kb

input:

1000
1000
BBBBBWWWWWBBBBWWBWWWBBBBWWWWWWWWBWWWBWWBWBBBBBBWWWBWBBBWBBBBBBBBBBBBWWWWBBWWBBBBWWBWWWBWBWWBBWWWWBBWBWBBWBBWWWWBBWWBBBBWWWBBBWBWWBBWWWBWWWWWWWBWWBBBWBBBWBBWWBWBWBWWWWBWBWBBWWBBWWBBBWBBWWWBBWWBWBWWBBBWBWBWWWWWWBWBWBWWBWWWBWWBWBWBWWBBWWWBBBBBBWWBWBWBBWWWWWBBBWWWBBBWBBBWBWWBBWWWWBWWWWWWWBBBBB...

output:

618887158
259367504
334837937
348964478
746040737
608936482
221004173
702780100
190518337
195037781
379687660
608717992
485360093
759239393
347486669
472407648
529892394
624233823
488932261
367223640
468196052
870179308
826058034
313050308
723990477
793709252
493414559
289754171
296121410
627338936
...

result:

ok 1000 numbers

Test #54:

score: 0
Accepted
time: 7ms
memory: 3400kb

input:

1000
1000
WWBBBBWBBWWBWBWWWBBWWBBBWBWBWBWWBBWWWBBWWBBWWWBBBBWWBWWBWWBWBWBBWBBWBWBBWBBBWBWBBWBWWBBWWBWWBBWBBBWBWBWBBBWBWBWWBBBBBBWBBWBWBBWBBBBBWWBBBWWWWBBBBWBWBBBBBWBBBWWBWBBBWBWWWBWBWWBBWBBWBWBBBBWBBBWWWWBWWBWWWWWWWWWWWWWBBWBWWWWWWBWBWWWWWBWBBWWWBBBWBWWBBBWBWWWBBWWWBWBBBWBBWBBWBWWWBBWBBWBBBBWWBWBWBB...

output:

98937121
733572977
561640543
753302622
216367277
647403555
123484706
279970518
299424529
397684641
893335648
602248470
880072694
615931492
97948881
784833297
624191613
836045588
966048580
83109166
840579058
762373586
694199776
989628446
872754287
339830061
420223221
189838537
887897552
940323353
817...

result:

ok 1000 numbers

Test #55:

score: 0
Accepted
time: 7ms
memory: 3372kb

input:

1000
1000
WWBBBBBBBWBBWBBBWWBBBBWBBBBBBWBBWWWBWWWBWWWBBBBWBWBBWBWWBWBBWWBWWBWWWWBWBBWWBWWWWWBBWBWWWWWBWBWWBBWWBWBBBBBWBWWWBWWBWBBBBBWBBWWBBBWBBBBBWBWBBWWWBWWWBBBBBWWWBWBWWBWWWWWWBBWWWBWWWBWBWWWWWWWBWBWBBWWBBWWWBWWBWBWWWWBBBWBWBBBWWBWBBWBWWBWBBWBWWBBBWWWBBWWWWBWWWBWBWBBBBWBWWWBBWBWWBBBWBBWBBBBBBBWBBB...

output:

641624367
762649613
140879019
134076107
157782067
568925805
235568014
844235805
451215881
126755305
265252723
205353364
357938359
981047608
733345638
357026213
131907903
179761649
896405574
34976686
892806715
752887010
799400907
916608909
67497101
682368546
711484226
27414654
741597817
18365382
4277...

result:

ok 1000 numbers

Test #56:

score: 0
Accepted
time: 4ms
memory: 3400kb

input:

1000
1000
BWWBWWWWWWWBBBBBBBWBWBWWBWWWWBWWWBWBWBBBBBBWWBBBBWWWBBBBWWBWBWWWBBBBWWWWWBWBBWWWWWWBBBBWBBBBWWWWWWWWWWWWWBWWBWWBBWBBBWBWBBBBWWWBWWWWWWBBBBWWBWBWWWBWBBWWWBWWWWBWBBBWWBBWBBBWWBBBBWWWWBBBWBWWWBBWWWWWWBBWBWBWBWWWBBWBWBBBWBBWWBBBBWBBBWBWWWWWBWBWBWBWWBBWWBWWWBWBBBWBWBBBBWWBWBWWWWWWBWWWBWWBBBWWBW...

output:

491149301
770899163
179396426
86125186
181304066
500676071
956968801
935135750
962103670
653524932
206688906
480324023
162341073
836853102
86604089
556119807
937461752
46495052
787049033
771652997
208744599
346897703
157695180
431851605
717459551
762685398
811966323
631656435
654144483
95055394
1342...

result:

ok 1000 numbers

Test #57:

score: 0
Accepted
time: 10ms
memory: 3464kb

input:

1000
1000
BBBWWWBBWWBWBBBWWWWBBBBWBWWWBBWWBWWWBWWWWWBWWWWBWWWWBBWBBWBWWBWBWBWBBWBBWWBWWWWBBWBBBBBWBWBBWWBBBBBBBBBBWBBWBBBWWBWWWWBWWWWBWBWBBWWWWWWWBWWWBWBWBBBBWWWWBWWBWBWWWWBBWWWWWBWBWBBWBBBBBWWWWWBBWWBWWBBWWBBWWWBWBWBWWWWBWBWBBBBBBBBWWBWBBBWWBBBWBBBWBWBBBBBBWWBWWWBBBWBWBWBBBWWWWBBWBBBBBWWBWWBBBBBBWB...

output:

413392060
546519679
332325534
912061176
782954151
32737026
973790144
521314820
26786345
910862279
840842489
598460008
884018185
599103475
953916196
158832956
409828871
392929285
203181594
639358390
668666154
830838365
258383795
693467744
496296374
19715081
452290189
69671778
333405164
422616966
3070...

result:

ok 1000 numbers

Test #58:

score: 0
Accepted
time: 3ms
memory: 3376kb

input:

1000
1000
BBBBBBWWBWBWBWBBWWBBBBBWBBWBBBWWBWWWWBBWWBBWBBBWBBBWBWBWWWWWWWBWWWWBBBWWWWBBBWWBBWBWWBBBWBBWBWWWBBWBWBWWWWBWBBBBWBWWBWWBWWBBBWWWBWWBWBBWBBWBBBBBWWBBBWBWBBBWWBWBWBBBBBWWWBBBWBWWWWWBWWWWBWWBWWWBBBWWBBWBBBWWBBBWBBBBWWBBWBBBBBBBWBBBWBWBWWWBBWWWWWWBBWWBWBBBWWBBWBWWBBWWWWBBWBBBWBBBBBWWBWWBWWBBBW...

output:

554993196
827406756
90263336
813851276
257951817
183215059
517085641
55832182
959229687
460510520
477940445
358799534
200332346
84205659
304506452
818640957
195174156
741926266
176394993
465710315
212256411
468485042
559674128
156756473
333435810
959155962
902502809
296129243
241922887
417781923
543...

result:

ok 1000 numbers

Test #59:

score: 0
Accepted
time: 7ms
memory: 3448kb

input:

1000
1000
BWBBWBBWBWWBBWBBWBWBWWWWBBWWBWBWWWWBWWBWWBWBWBWWWBBBWWBBWWWBWBBWBBBBBBWBWWWWBBBBWWWBWBWBWBWBBWWWBWWBBWBBWBWBBBWBWWBBWWWWBBWBBBWBBWWWWBWBBBWBBBWBBWWWWBBWBBBWWWBBWWBBBBWBWBWWBBBBBBBWBBWBBWBWBWBWBWWBWBBBBBWBBBWBBWWWWBBWBBWWBBBWWBBBWWWWWBWWWWWBBWBWBBBBWWBWBWWWBBWBBWBWBBBBWWBBBWWBBWWBWWWBWBBBBB...

output:

596162961
620588985
83938975
874764794
823139266
658257924
890014681
906693284
492554801
507194477
617147601
295657799
167776136
607345436
235940960
192729042
511233845
528780923
414665066
623502034
988845200
644191555
414188768
305439720
800706182
331407159
578399831
443118522
141956230
436816948
2...

result:

ok 1000 numbers

Test #60:

score: 0
Accepted
time: 14ms
memory: 3372kb

input:

1000
1000
WWBWWBBWBWWBBWWWBWBWBWBBWWWBWBWWBBWWBBWBBWWBBWWBWBBBBWBWBWWBWBWWBWWWBBBWWWWBWBBBWWWWBWWBBBWBBWBBBWWBBWWWWWWWWBWWBWBWWWWBBWWWBBWBWBWWWWWWBWBWBBBWBBWBWWBWBBBWWWBBBBBBBWWBBBWWBBBWBWBWBBBWWWWBWBWWBBWBBBWBWWWWWBWBBWWBWBWWBWBWBWBWBWWBWWWWBBBWWBWBWWWWBBBBBBWBWWWWBBBBWBBWWBWWBBBBWWBWBWWBWWWWWWWBWB...

output:

918948192
69380674
817411857
322414198
625176226
971979039
849312320
930253369
293830390
35770056
443934369
96764793
137361113
24627507
182683134
526951221
770682234
862902820
101696290
713644562
215057903
92386618
963339559
264587697
87662981
770440400
365795906
881019010
360903820
837532844
441518...

result:

ok 1000 numbers

Test #61:

score: 0
Accepted
time: 13ms
memory: 3400kb

input:

1000
1000
BBBBBWBBWBWWBBWBBWWWBBWWBBWWBWWWWWWWBWBWWBWWWWWWBWBBBWBBBWWBBBBWBWWWBBWWBBBWBWBWWWWWWWBBBBWBWWWBBBBWWWWBBBBWWBWWBBBWWBWBBBWWBBBWWBWWBBWBWWWWWWBWWBWBWWWBBBBWWWWBWBBWWWBBBWWWWBWWBWWWWBWWWBBWWBWWWBWWBBBWWWBWWWWWBBBBWBWBWBWWBBWBBWWBBBBBBWBWBBWBWWWWWWWBWWWWWBWBWWBBBWBWWWBBBWWWBBBWBBBWBWBBWBBWBW...

output:

759358579
944543712
914598680
538362362
90155609
822033424
863432977
90740868
341149891
372876686
969442609
554674599
955118022
584230742
507657356
515065262
16529919
68044282
239658721
12321154
463227496
845665503
991568788
542081339
547519170
50674228
554170212
947627917
214524640
219996893
376064...

result:

ok 1000 numbers

Test #62:

score: 0
Accepted
time: 17ms
memory: 3388kb

input:

10000
100
BBBWWWBBBBBBBWBBBBBWBWWWWBWBWWWWBWBBBWWBWWBBBWWBBWWWBWWBBBBWBBWWBWWBWBWBWWWBWBWWWBBBBBBBBWWBWWWWBBWBWWWBBBWBBWBWWBBWBWWWWWWBWWWBWBWWBWWBBWBBBWWWBWWBBWBWWWBBBBWWBWBBBBWWBWWWWBBWBWBBBBWBWBWBBWBWWBBBWWWW
100
WBWWBWWBBBWBBWBWBBWBBBBWBWBBBWBBBWWWBBBBBWWBWBWBBBBWBBWBWWWWBWWWBBBBBWWWBWWWWWWWWWBBW...

output:

216097777
780575005
534261869
160999194
312126058
572331279
332597723
833423099
900670838
338752460
115828170
735315187
322391809
280200208
712208250
831969870
226906349
789991567
292485067
417389479
905755724
277893139
983828667
719255236
187532068
437712555
387874800
122691509
123416865
186619337
...

result:

ok 10000 numbers

Test #63:

score: 0
Accepted
time: 8ms
memory: 3452kb

input:

10000
100
WWWWBWWBBBWBBBWWBBBBWWBWBBBWWWBBBWBWBBWWWWBBBBBBWWWBWWBBBBBWBWBWBBWWWBWBBWWBBBBWBBWWWWBBBWBBBBBBWBWWBWBBBWBWBBWWBWWWBWWBWBWBWBBWWBBWBBWBBWWWWWBWBBWBWBWBWWWWBWWWBBWWWBWBWBWWWWWBBBWWBWBBWWBWBWWBBBWWWWWB
100
WWWWBBBBBWBBBWBBBBBWBBBWBWWWWBBWBBWBWWBWBWBBBWWBBWWWWWBWWBWBBBBBWWWBWWBWBWBWBWWBWWWWW...

output:

581198576
597565253
785051889
9314742
381462278
264855048
55328329
481914424
590338143
951313333
893482804
709366949
397943209
645185902
906489522
765631294
726254889
513581669
381252951
39135541
50770999
764400666
721237769
948952267
954788951
401608611
891771795
703311683
467157519
171660902
46575...

result:

ok 10000 numbers

Test #64:

score: 0
Accepted
time: 17ms
memory: 3384kb

input:

10000
100
WBBWWBWWWWWBBWBWWBWWBWWBWBBWWWWBBWBWWWWWWWWBBWBWWBWBWWBBBBBWBBBWBBWBWBWBBBBBBBWBWWWBWBBBBWBBBBWBWWWWWBBBBBBWWBWBWBBBBBWWWWBWWWBWWWBBWWBWBWBBBBWWWWBWBBWBBBBBBBWWWWBBBBBBWBWWWBBWWWBBWBWWWBBWWWWWWBWWWBBB
100
BBBBBWWWBBBWWBWWBWWBBWWBBWWWBBWWBBBWBBBWBBWWWWWWWBWWWWWBWWWWBBWBBBBBBBBBWBBWWBWWBWWWW...

output:

836216602
226286558
952399861
159413536
636480863
863242452
450956902
356592449
407378552
887661933
35048671
441251013
36749896
679722580
362544338
144735981
592827617
732446486
39294034
4478694
889327423
601839880
2844532
59697671
308089228
104262309
467936716
401913454
635207528
437928274
85274035...

result:

ok 10000 numbers

Test #65:

score: 0
Accepted
time: 17ms
memory: 3364kb

input:

10000
100
BWWWBBBWWBBBWBWWBBWWBWBWWBBBWBBBWBBWWWWWWBBWWBWBWWBBBWWBBBWBWBWBWBWWWWWBBBWBBBWWWBBBWBBBBBWWWBWWWBBWWWBBWBWBWWBBWWWBWWBBBBBBWWWBBBBWWWBBWWBWWWWBWBWBWBBBWWBBWBBBWWWBWWBBWWBWWBBWWWBBWWBBBBBWWWWBBWBBWBWW
100
WWBWBWBBWBBBBBBWWBBBWWWWBWBWBBBBWBWBBWBWWBWBBBBWWBWWBWBWWWWBBWWBBBWWBWBBBWBBWBBWBWBWB...

output:

947075834
909634070
799713847
419914249
748507969
415898180
74203971
222263935
544707340
875960261
103530940
457177080
550511733
240716412
736073344
829977588
927716055
198820619
164344595
836651672
861771668
989006250
224462846
752590704
176632602
191926086
163472706
229867979
148571560
90845542
44...

result:

ok 10000 numbers

Test #66:

score: 0
Accepted
time: 10ms
memory: 3456kb

input:

10000
100
WBWBBWWWBBWWBBWBBWWBWWWWWBBWWBBBWWWWBWWBWBBWWWBBBBWWWBWBBBBBWBBBBWWWBWBBBBBBBWWBBWWWWBWWBBBBWBBBWBWWWWBWBBWWBWWBBBWBWWBWWBWBBWBWBWWWWBBBWBWWWWBWWWBBWBWBBBWBWBBWWBBWWBBWWBBBWBWWWWWBBBWWWWBBWBWBWWBBWBBB
100
WWBBBWBWBBBWBWBBBWWWWBWBBWWWBWBBBBWBWWBWWBWBWWWWBBWBWBWBWWBWWWWWWWBBWBWWWBBBWBBWBBWWB...

output:

308145404
455173116
835228039
929165729
804528556
460989231
460198495
773070047
673260577
71561801
371553401
877448428
703095987
580814314
413579962
337475070
125051849
944014577
869333153
380598907
129504603
170863246
311649423
281652712
794886020
284004037
728968047
161527676
681255001
144566004
7...

result:

ok 10000 numbers

Test #67:

score: 0
Accepted
time: 17ms
memory: 3376kb

input:

10000
100
WWBWWBBWWWBBWWWBBBBBWBWBWBBWBBWWWBWBWWWBWWBBBBBBBWWBWBBBWWWBBWBBWWWBBBWBBBWWBWBWBBBWBBWWBWWWWBWWWBWWBBBWBWBWBWWWBBBBWWBBBBWBWWWBWBBWBBBWWBWBWBWBWWBWWBWBBWBWWWBBWBBWBWWWBWWBWBWWBWBBBBWBBWWBBBBBWWWWWWWW
100
BBWBWWWWWWWWBWBWWBWWWBBBWBBBWBWBBWBBWBWBBBBBWBWWWBWWWWBWBBWBWWBWWBBWWBBWBBBBBBWBWBWBW...

output:

131054646
990259463
718881710
790238835
54835347
340553888
962681941
438792207
807355674
198049427
820840702
741023793
689625675
766435104
924541516
271191099
74131080
592833260
385868502
237306599
842008736
923338165
466752962
485024047
562431892
493811079
518149386
790027653
193623788
907979301
80...

result:

ok 10000 numbers

Test #68:

score: 0
Accepted
time: 17ms
memory: 3368kb

input:

10000
100
WWBBBWBWWBBWBBBBBBBWBWWWBBBBBWWBWWBWBWBBWBWBBWBBBWBBWWWWBBWWWBWBWWWBBBWBBWBBWBWBBBWBBWWBWWWBWBBBBWWBWWWWBBBBWBBBWWWWWBWBWWBWBBBWWWWBWBWWWWWWBBBWWBBBWWWBWBWBWBWBBBWWWBWWWWWBBBBWBWWWBWBBBWBWBBWWWWWBWBWB
100
BBWWBWBWBBBBBBBWBWWBBBWWBBBWBWBBBBWWWWBWWBBWBWWWBWBBWBBWBWWBBWWWWBWWWWBWWBBWBWWWWBBWW...

output:

519131264
918170745
158052813
643412995
737429797
314819367
313096834
608113747
219586365
645029369
802321137
276500955
875180303
200090884
259708189
925696834
829125864
874674289
71133332
334028504
610487932
531419943
728582350
236058242
515825526
81654955
102777402
246636607
92931271
377103720
919...

result:

ok 10000 numbers

Test #69:

score: 0
Accepted
time: 11ms
memory: 3392kb

input:

10000
100
BWBBBBWWBBBWBWWBBBBBWWBWWBWWBWWBBWWBBWBBBWBWWBWWWWWWWBWBWWBWWBBBWBWWBWBWBWBWWBWBWBBBBBWBWWWBBBBBWWWBWBBWWBBWWBWWBWWBBBWWBBBBWBWWBWBBBWBBWBWBBWBWBBWWBWWBBWWWWWWWWBBBBWWBWWWWWBBWBWWWBBBBBBWWWBBWWWBBWBWB
100
BBWBBWWBWBWBBWWBBWWBWBWBWWBWWBBBWBWBWWWWWWWWWBBBBBBBBWBWBBBBBWWBWBWWWWBBBWBWWBBWWWWWW...

output:

891823281
908866939
888662300
427756037
733306347
784367839
736479500
936487632
638961678
925915388
760834472
950234233
559075661
628728063
462711735
375441896
120217689
704501572
290358519
885007092
564928247
464676399
72822621
69879075
173153653
974835196
896937479
992183422
945480540
23271552
281...

result:

ok 10000 numbers

Test #70:

score: 0
Accepted
time: 13ms
memory: 3376kb

input:

10000
100
BWBBBWBBBWBBBWBWWBWBWWBWBWWBWBBWWBBWWWBBBBBBWBBWBWBBBBBWWWBBWWBWWWBBBWWWBBBWWWWWBBBWWBBWBWWWBBWWWBWBWWWBBWWBBWBBBWBWWBBWBWBBWBBWWBWBBWBWWBWBBBWBBBWWWWWWWWWBWWBWBWBWBBBWBBBWBBBWWBWWWWWWWBBWBWWWWWBBWBBW
100
BBWBBBWBWBBBBWBBWWWWWBWBWBWBBBBWBWWWBWWWBWBWBBBBWWWWWBWWBBBWWWWBBBBBBBWBWWBWWWBBWWWWW...

output:

153395055
937541824
276559311
934976298
147234003
233527212
521160885
496468561
983311975
950111017
863351544
475069744
653948962
726247139
61265435
707411807
279706881
516957662
913767018
973054738
828646890
936874645
386784799
537129661
653729718
481490102
875315059
293666005
7561387
989132933
176...

result:

ok 10000 numbers

Test #71:

score: 0
Accepted
time: 17ms
memory: 3444kb

input:

10000
100
BWWBWWWBBBBBWBWBWBWBWBWBWBBBBBBBWWWWWBBWBWWBWBBWBBWBWBWWBWWWBBWWWBBWBWBWBWBWWWWWWBWWBWBBBBWWBWBWBWBWBWBWWWWWWBWBBWWBBBWWBWWWWWWWBBWWBWBWWWBWBBWBBBBBWWBBBBBBWWWWBBBBWBWBBBWWBBBWWBBBWWBBBWBBWWBBBWBWWBWW
100
WWWBBWBBWWWBBWBWWBWBBBWBBWBBWWWWWWWWWBBBBBBWWBWBWBBWBWBBWBBBBBBBWBBWBWWWWBWBWBWWWWWBB...

output:

568509133
953690551
218488576
273664645
573626237
477008714
575143591
118673604
916757237
187797930
765389193
703325306
172976108
116947459
125541620
502021252
612821346
317266468
70262066
108261619
997712027
427146310
765990677
85661014
25093468
262896428
211539440
878118999
119184477
197952018
543...

result:

ok 10000 numbers