QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323586#944. CubewordCamillus100 ✓869ms10412kbC++203.5kb2024-02-10 03:22:392024-02-10 03:22:41

Judging History

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

  • [2024-02-10 03:22:41]
  • 评测
  • 测评结果:100
  • 用时:869ms
  • 内存:10412kb
  • [2024-02-10 03:22:39]
  • 提交

answer

/// @author Camillus
#include "bits/stdc++.h"

using ll = long long;
using namespace std;

struct mint {
    static constexpr int mod = 998'244'353;
    int value = 0;
 
    mint() = default;
    mint(int value) : value(value) {}
 
    mint& operator+=(const mint &other) {
        value += other.value;
        if (value >= mod) {
            value -= mod;
        }
        return *this;
    }
 
    mint operator+(const mint &other) const {
        mint result = *this;
        return result += other;
    }
 
    mint& operator-=(const mint &other) {
        value += mod - other.value;
        if (value >= mod) {
            value -= mod;
        }
        return *this;
    }
 
    mint operator-(const mint &other) const {
        mint result = *this;
        return result -= other;
    }
 
    mint& operator*=(const mint &other) {
        value = 1ll * value * other.value % mod;
        return *this;
    }
 
    mint operator*(const mint &other) const {
        mint result = *this;
        return result *= other;
    }
 
    mint power(int k) const {
        mint result = 1;
        mint current = *this;
 
        while (k) {
            if (k & 1) {
                result *= current;
            }
            current *= current;
            k >>= 1;
        }
 
        return result;
    }
 
    mint& operator/=(const mint &other) {
        return this->operator*=(other.power(mod - 2));
    }
 
    mint operator/(const mint &other) const {
        mint result = *this;
        return result /= other;
    }
 
    bool operator==(const mint &other) const {
        return value == other.value;
    } 
};

static constexpr int SIGMA = 26 + 26 + 10;
mint cnt2[SIGMA][SIGMA];
mint cnt3[SIGMA][SIGMA][SIGMA];

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

    int n;
    cin >> n;

    map<int, vector<string>> b;

    map<int, int> ord;

    int sigma = 0;

    for (char x = 'a'; x <= 'z'; x++) {
        ord[x] = sigma++;
    }
    
    for (char x = 'A'; x <= 'Z'; x++) {
        ord[x] = sigma++;
    }

    for (char x = '0'; x <= '9'; x++) {
        ord[x] = sigma++;
    }

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        b[s.size()].push_back(s);
    }

    mint ans = 0;

    for (const auto &[x, y] : b) {
        memset(cnt2, 0, sizeof(cnt2));
        memset(cnt3, 0, sizeof(cnt3));

        set<string> z;
        for (const string &s : y) {
            string t = s;
            reverse(t.begin(), t.end());
            z.insert(t);
            z.insert(s);
        }

        for (const string &s : z) {
            int a = ord[s.front()];
            int b = ord[s.back()];
            cnt2[a][b] += 1;
        }

        for (int a = 0; a < SIGMA; a++) {
            for (int b = 0; b < SIGMA; b++) {
                for (int c = 0; c < SIGMA; c++) {
                    for (int d = 0; d < SIGMA; d++) {
                        cnt3[a][b][c] += cnt2[a][d] * cnt2[b][d] * cnt2[c][d];
                    }
                }
            }
        }

        for (int a = 0; a < SIGMA; a++) {
            for (int b = 0; b < SIGMA; b++) {
                for (int c = 0; c < SIGMA; c++) {
                    for (int d = 0; d < SIGMA; d++) {
                        ans += cnt3[a][b][d] * cnt3[a][b][c] * cnt3[c][b][d] * cnt3[a][c][d];
                    }
                }
            }
        }
    }

    cout << ans.value << '\n';
    return 0;
}

詳細信息

Subtask #1:

score: 21
Accepted

Test #1:

score: 21
Accepted
time: 809ms
memory: 10156kb

input:

100000
aaa
aaaa
aaaaa
aaaaaacb
aaaaabfdab
aaaaacaeba
aaaaacbec
aaaaacc
aaaaacdde
aaaaad
aaaaaef
aaaaafe
aaaab
aaaaba
aaaabac
aaaabcab
aaaabdcab
aaaabddec
aaaabeabd
aaaabeeacc
aaaac
aaaacaafee
aaaacabec
aaaacad
aaaacb
aaaacbcbba
aaaacbddbe
aaaacc
aaaacdda
aaaacdf
aaaacecdca
aaaacfceed
aaaacfdef
aaaad...

output:

966519702

result:

ok 1 number(s): "966519702"

Test #2:

score: 0
Accepted
time: 815ms
memory: 10336kb

input:

99999
aaa
aaaa
aaaaa
aaaaaad
aaaaabcee
aaaaabecdc
aaaaabecf
aaaaacdfcc
aaaaad
aaaaadab
aaaaaecaab
aaaaaee
aaaaafafd
aaaaafccf
aaaab
aaaaba
aaaabad
aaaabada
aaaabc
aaaabcaecb
aaaabd
aaaabdfb
aaaabede
aaaabefedb
aaaabfeaa
aaaabffddb
aaaac
aaaacbbcc
aaaacbec
aaaaccb
aaaaccbfee
aaaaccde
aaaacceb
aaaacd
...

output:

884966963

result:

ok 1 number(s): "884966963"

Test #3:

score: 0
Accepted
time: 820ms
memory: 10376kb

input:

99998
aaa
aaaa
aaaaa
aaaaaaa
aaaaaae
aaaaac
aaaaaccb
aaaaadb
aaaaadcbd
aaaaafedd
aaaaaff
aaaab
aaaabadd
aaaabbeb
aaaabc
aaaabceca
aaaabcf
aaaabd
aaaabdce
aaaabe
aaaabf
aaaabfab
aaaabfad
aaaabfeffb
aaaac
aaaacaecbb
aaaacb
aaaacbdb
aaaacda
aaaacdd
aaaacdddaf
aaaace
aaaacecde
aaaacfeff
aaaacffe
aaaad
a...

output:

519865738

result:

ok 1 number(s): "519865738"

Test #4:

score: 0
Accepted
time: 818ms
memory: 10404kb

input:

99997
aaa
aaaa
aaaaa
aaaaaa
aaaaaac
aaaaaaed
aaaaab
aaaaac
aaaaad
aaaaadbdf
aaaaaf
aaaaafc
aaaaafe
aaaaaffebf
aaaab
aaaaba
aaaababaa
aaaababdca
aaaabacbcb
aaaabae
aaaabaeec
aaaabc
aaaabdb
aaaabddeab
aaaabfe
aaaac
aaaacbafdf
aaaacbfbcb
aaaaccfe
aaaacd
aaaacdfb
aaaacecfaa
aaaaceeea
aaaacfbaf
aaaacffb
...

output:

440905828

result:

ok 1 number(s): "440905828"

Test #5:

score: 0
Accepted
time: 814ms
memory: 10224kb

input:

99996
aaa
aaaa
aaaaa
aaaaaaea
aaaaab
aaaaabaf
aaaaabcb
aaaaac
aaaaacbcce
aaaaadb
aaaaadf
aaaaaeaf
aaaaaeb
aaaaaef
aaaaaefd
aaaaafeee
aaaab
aaaabaacca
aaaabb
aaaabbdd
aaaabc
aaaabcc
aaaabcdb
aaaabcdbbb
aaaabcdf
aaaabce
aaaabde
aaaabdefb
aaaac
aaaacaee
aaaacafa
aaaacb
aaaacbb
aaaaccebfc
aaaacd
aaaacdf...

output:

606830795

result:

ok 1 number(s): "606830795"

Test #6:

score: 0
Accepted
time: 813ms
memory: 10156kb

input:

99995
aaa
aaaa
aaaaa
aaaaaaa
aaaaaaabcf
aaaaaaaccf
aaaaaaafb
aaaaaad
aaaaaaf
aaaaab
aaaaabecfc
aaaaac
aaaaacbc
aaaaacc
aaaaaceee
aaaaacffc
aaaaad
aaaaadfccf
aaaaaec
aaaaaee
aaaaaefaec
aaaab
aaaabaffab
aaaabbaadc
aaaabbd
aaaabbed
aaaabdcebd
aaaabeacf
aaaabedfc
aaaabfcd
aaaabfe
aaaac
aaaaca
aaaacaf
aa...

output:

293744889

result:

ok 1 number(s): "293744889"

Test #7:

score: 0
Accepted
time: 805ms
memory: 10196kb

input:

99994
aaa
aaaa
aaaaa
aaaaaa
aaaaaaab
aaaaaabdd
aaaaacbfb
aaaaacfeef
aaaaadab
aaaaae
aaaaaeaf
aaaaaf
aaaaafac
aaaab
aaaababdb
aaaabb
aaaabbadf
aaaabbec
aaaabccc
aaaabde
aaaabdffbf
aaaabefdfa
aaaabff
aaaabffdf
aaaac
aaaacaf
aaaacafed
aaaacbeccd
aaaaccbbb
aaaacd
aaaacdba
aaaacddafb
aaaacdf
aaaacdfdc
aa...

output:

745454877

result:

ok 1 number(s): "745454877"

Test #8:

score: 0
Accepted
time: 810ms
memory: 10208kb

input:

99993
aaa
aaaa
aaaaaa
aaaaaaa
aaaaaabdf
aaaaabbee
aaaaac
aaaaaccfaf
aaaaadbece
aaaaafa
aaaaafacb
aaaab
aaaabadda
aaaabb
aaaabbacd
aaaabbea
aaaabcddb
aaaabdbff
aaaabfb
aaaabfee
aaaac
aaaaca
aaaacbbc
aaaacbecb
aaaacc
aaaaccbbec
aaaaccc
aaaacdcb
aaaacddd
aaaacdfcba
aaaaceae
aaaacecdfe
aaaacfc
aaaad
aaa...

output:

429068770

result:

ok 1 number(s): "429068770"

Test #9:

score: 0
Accepted
time: 805ms
memory: 10224kb

input:

99992
aaa
aaaa
aaaaa
aaaaaaccb
aaaaaacdef
aaaaaadfd
aaaaaafd
aaaaab
aaaaabd
aaaaabeee
aaaaacda
aaaaacf
aaaaad
aaaaadbca
aaaaaeed
aaaaafccfb
aaaab
aaaababb
aaaabaddb
aaaabafadc
aaaabbb
aaaabbd
aaaabcd
aaaabce
aaaabf
aaaabfa
aaaabfbf
aaaabfcac
aaaabfd
aaaabfde
aaaabff
aaaabffdc
aaaac
aaaaca
aaaacae
aa...

output:

289771162

result:

ok 1 number(s): "289771162"

Test #10:

score: 0
Accepted
time: 807ms
memory: 10412kb

input:

99991
aaa
aaaa
aaaaa
aaaaaaad
aaaaac
aaaaacecbf
aaaaacfa
aaaaadcdc
aaaaae
aaaab
aaaabafafe
aaaabee
aaaabeeb
aaaabf
aaaabfdcc
aaaacaeffe
aaaacc
aaaaccab
aaaacded
aaaace
aaaacea
aaaaceaad
aaaaceaecc
aaaacfeb
aaaacff
aaaad
aaaada
aaaadaf
aaaadba
aaaadbfe
aaaadc
aaaadcf
aaaadd
aaaaddae
aaaaddcf
aaaade
a...

output:

875542265

result:

ok 1 number(s): "875542265"

Test #11:

score: 0
Accepted
time: 843ms
memory: 10092kb

input:

99990
aaa
aaaa
aaaaa
aaaaaba
aaaaabdcd
aaaaac
aaaaacbfcf
aaaaada
aaaaaed
aaaaaeeec
aaaaafdc
aaaaaffadc
aaaab
aaaabaddd
aaaabceeeb
aaaabda
aaaabf
aaaabfaffe
aaaabfedcd
aaaac
aaaaca
aaaacab
aaaacabdfc
aaaacaf
aaaacbaea
aaaacbb
aaaacccbf
aaaaccecaf
aaaacdf
aaaacede
aaaaceebea
aaaaceeddd
aaaacfba
aaaad
...

output:

236060052

result:

ok 1 number(s): "236060052"

Test #12:

score: 0
Accepted
time: 810ms
memory: 10268kb

input:

99989
aaa
aaaa
aaaaa
aaaaaadfdd
aaaaabee
aaaaac
aaaaacbb
aaaaaed
aaaaaedbe
aaaaafae
aaaab
aaaababfa
aaaabacb
aaaabbcefd
aaaabc
aaaabccebb
aaaabeaea
aaaabeb
aaaabeca
aaaabed
aaaabedb
aaaabfaba
aaaabfbdb
aaaabfd
aaaabfdf
aaaabffeb
aaaac
aaaaca
aaaacad
aaaaccacbc
aaaaccafaa
aaaaccb
aaaacdccc
aaaacdff
a...

output:

382736648

result:

ok 1 number(s): "382736648"

Test #13:

score: 0
Accepted
time: 821ms
memory: 10176kb

input:

99988
aaa
aaaa
aaaaa
aaaaaacc
aaaaaaeef
aaaaab
aaaaabfbdc
aaaaabfdb
aaaaaccdca
aaaaacfbc
aaaaadf
aaaaaede
aaaaaf
aaaaafdbcd
aaaaafea
aaaab
aaaabbae
aaaabbbda
aaaabbd
aaaabbec
aaaabc
aaaabcacc
aaaabcaeca
aaaabce
aaaabdbae
aaaabdbb
aaaabee
aaaabfead
aaaabfeefb
aaaac
aaaacb
aaaacbbe
aaaacccfaa
aaaaccd
...

output:

778837075

result:

ok 1 number(s): "778837075"

Test #14:

score: 0
Accepted
time: 831ms
memory: 10324kb

input:

99987
aaa
aaaa
aaaaa
aaaaaabe
aaaaaacbbc
aaaaaacecf
aaaaaadc
aaaaaaeffd
aaaaab
aaaaabf
aaaaacab
aaaaaccbaf
aaaaacd
aaaaacdeca
aaaaacec
aaaaaceda
aaaaacf
aaaaadc
aaaaadefe
aaaaae
aaaaaeaab
aaaaafabe
aaaaafaf
aaaaafddad
aaaaaffccd
aaaab
aaaabafb
aaaabdbca
aaaabdebe
aaaabecca
aaaabfba
aaaabfbb
aaaabfbd...

output:

265167705

result:

ok 1 number(s): "265167705"

Test #15:

score: 0
Accepted
time: 808ms
memory: 10328kb

input:

99986
aaa
aaaa
aaaaa
aaaaaa
aaaaaaafc
aaaaaabcfa
aaaaaabdbb
aaaaaabfd
aaaaaadd
aaaaaadf
aaaaab
aaaaabbba
aaaaabcc
aaaaacebdd
aaaaad
aaaaaddbcb
aaaaaf
aaaaafa
aaaaafaaba
aaaaafea
aaaab
aaaababdc
aaaababfc
aaaabaccbe
aaaabb
aaaabbcb
aaaabbfecf
aaaabdad
aaaabe
aaaabecea
aaaabeddc
aaaabfdbec
aaaac
aaaac...

output:

376583661

result:

ok 1 number(s): "376583661"

Test #16:

score: 0
Accepted
time: 804ms
memory: 10204kb

input:

99985
aaa
aaaa
aaaaa
aaaaaa
aaaaaadaed
aaaaaae
aaaaabbdb
aaaaac
aaaaadadba
aaaaaeb
aaaaaefdd
aaaaafd
aaaaafe
aaaaaffde
aaaab
aaaababbda
aaaabace
aaaabaf
aaaabbfcf
aaaabcefad
aaaabdacfb
aaaabdef
aaaabe
aaaabeab
aaaabfd
aaaabfdbf
aaaac
aaaacbbef
aaaacc
aaaacd
aaaacdae
aaaacdfea
aaaace
aaaacec
aaaacfbf...

output:

546456611

result:

ok 1 number(s): "546456611"

Test #17:

score: 0
Accepted
time: 816ms
memory: 10324kb

input:

99984
aaa
aaaa
aaaaaaca
aaaaaaecf
aaaaabdde
aaaaabfc
aaaaacaefc
aaaaacbfed
aaaaacf
aaaaadcec
aaaaadeabf
aaaaafdee
aaaab
aaaabafecf
aaaabbe
aaaabdbde
aaaabebac
aaaabfe
aaaabffa
aaaac
aaaacbbdb
aaaacbe
aaaaccead
aaaacdaace
aaaacdaf
aaaacee
aaaacfa
aaaacfeae
aaaad
aaaada
aaaadaddbb
aaaadb
aaaadba
aaaad...

output:

82579691

result:

ok 1 number(s): "82579691"

Test #18:

score: 0
Accepted
time: 815ms
memory: 10160kb

input:

99983
aaa
aaaa
aaaaa
aaaaaab
aaaaac
aaaaaca
aaaaacbdd
aaaaad
aaaaadf
aaaaae
aaaaaeedbb
aaaaaf
aaaaafd
aaaaafda
aaaaba
aaaabaccb
aaaabada
aaaabafba
aaaabb
aaaabbb
aaaabcbf
aaaabcc
aaaabccea
aaaabceec
aaaabd
aaaabdaeaf
aaaabe
aaaabead
aaaabeafc
aaaabefc
aaaabefda
aaaabfdce
aaaaca
aaaacabfd
aaaacbaaf
a...

output:

843794331

result:

ok 1 number(s): "843794331"

Test #19:

score: 0
Accepted
time: 826ms
memory: 10316kb

input:

99982
aaa
aaaa
aaaaa
aaaaaa
aaaaabfcd
aaaaac
aaaaacc
aaaaacccde
aaaaae
aaaaaea
aaaaaeaa
aaaaaebce
aaaaaec
aaaaaf
aaaab
aaaabaa
aaaabac
aaaabae
aaaabbc
aaaabbdf
aaaabbf
aaaabc
aaaabddaf
aaaabdef
aaaabfdcc
aaaabfea
aaaabff
aaaac
aaaacab
aaaacb
aaaacbfe
aaaacc
aaaacca
aaaaccabe
aaaacd
aaaacdaefe
aaaacd...

output:

73145981

result:

ok 1 number(s): "73145981"

Test #20:

score: 0
Accepted
time: 806ms
memory: 10240kb

input:

99981
aaa
aaaa
aaaaa
aaaaaa
aaaaaaac
aaaaaba
aaaaacd
aaaaadf
aaaaaef
aaaaafae
aaaaaffd
aaaab
aaaabbaca
aaaabbedb
aaaabc
aaaabcc
aaaabccd
aaaabddd
aaaabebbca
aaaabebbe
aaaabebbea
aaaabec
aaaabece
aaaabedade
aaaabeee
aaaabfcba
aaaac
aaaacaacbc
aaaacbbeda
aaaacbe
aaaacbfbd
aaaacdd
aaaaceeaa
aaaacf
aaaa...

output:

328200997

result:

ok 1 number(s): "328200997"

Test #21:

score: 0
Accepted
time: 811ms
memory: 10120kb

input:

99980
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaab
aaaaabb
aaaaac
aaaaacfcab
aaaaaddd
aaaaadfa
aaaaaedfcc
aaaaaf
aaaab
aaaabaa
aaaabab
aaaabb
aaaabbd
aaaabbfcb
aaaabc
aaaabcaccd
aaaabd
aaaabdacd
aaaabde
aaaabeec
aaaac
aaaacabeff
aaaacadb
aaaacba
aaaacbc
aaaacbcbc
aaaacbd
aaaaceceef
aaaacf
aaaacfb
aaaacfcdec...

output:

975997785

result:

ok 1 number(s): "975997785"

Subtask #2:

score: 29
Accepted

Dependency #1:

100%
Accepted

Test #22:

score: 29
Accepted
time: 812ms
memory: 9404kb

input:

100000
aaa
aaaa
aaaadfnl
aaab
aaabf
aaabgbohpg
aaac
aaadhgjebb
aaadjfc
aaaeigcc
aaaekhec
aaafgb
aaaggn
aaagifb
aaahmjhb
aaaj
aaajokcjd
aaakaiojjl
aaakb
aaalgb
aaalpkf
aaam
aaamehmil
aaane
aaanmo
aaaobb
aaaogddkfh
aaap
aaapifl
aab
aaba
aabakfm
aabcb
aabcbhb
aabembjed
aabf
aabfmoppgf
aabh
aabhkj
aabhl...

output:

79035388

result:

ok 1 number(s): "79035388"

Test #23:

score: 0
Accepted
time: 816ms
memory: 9412kb

input:

99999
aaa
aaabdh
aaablohf
aaacfk
aaacghba
aaaeb
aaaegajda
aaaekcadaa
aaaenk
aaah
aaahakeg
aaajdnj
aaalijda
aaaog
aaapbjco
aaappo
aab
aabdhnenj
aabdmh
aabe
aabegib
aabegn
aabepf
aabfbmdgj
aabg
aabgcan
aabi
aabiblkg
aabip
aabjjf
aablmkocob
aablokne
aabmmpop
aabmpfloil
aabplllfb
aac
aacafn
aacaneggj
aa...

output:

329231054

result:

ok 1 number(s): "329231054"

Test #24:

score: 0
Accepted
time: 820ms
memory: 9476kb

input:

99998
aaa
aaaaen
aaaam
aaab
aaacekneo
aaad
aaadpceei
aaaeak
aaaebgo
aaaeipj
aaaejh
aaaenbnkjl
aaafjjkl
aaagjofbdd
aaahbjfabn
aaahojaf
aaajglh
aaakfhp
aaako
aaalifgce
aaangcjh
aab
aabaja
aabb
aabbn
aabbp
aabfpb
aabg
aabghjcmhl
aabhdgc
aabhgfcjka
aabiogng
aabj
aabjdm
aabjikjp
aabk
aabldjhaib
aabm
aabm...

output:

680075672

result:

ok 1 number(s): "680075672"

Test #25:

score: 0
Accepted
time: 819ms
memory: 9240kb

input:

99997
aaa
aaaaabioi
aaaaeba
aaaaggh
aaabidpgja
aaabldadp
aaaddojl
aaadfknb
aaaeejeidd
aaaelkfma
aaaf
aaafccc
aaagaaj
aaagmhefa
aaahg
aaaiddlkpk
aaaiepe
aaaiifphhc
aaaj
aaajjcea
aaakfop
aaakmkmfpg
aaaldda
aaalfnnald
aaalg
aaamamdi
aaamgainnd
aaan
aaanlfjk
aaanmh
aaaongkppj
aaap
aaaphagn
aab
aabacfi
a...

output:

179927059

result:

ok 1 number(s): "179927059"

Test #26:

score: 0
Accepted
time: 838ms
memory: 9524kb

input:

99996
aaa
aaaaeipam
aaaajo
aaabb
aaaebpicpi
aaaeica
aaafocddm
aaahedddoj
aaaidbjmll
aaaiofick
aaajhcod
aaajopidmc
aaakhifjp
aaalalpmh
aaaldnk
aaalfpj
aaamacj
aaamcepgc
aaaniogaab
aab
aababik
aabcbamppg
aabcidom
aabclpa
aabd
aabeogdajh
aabfgc
aabgaoighc
aabgdg
aabgmnhod
aabi
aabk
aabkce
aabkfebdjn
aa...

output:

654954751

result:

ok 1 number(s): "654954751"

Test #27:

score: 0
Accepted
time: 823ms
memory: 9464kb

input:

99995
aaa
aaaaafhhh
aaaai
aaaapg
aaabdhgpl
aaabfibgb
aaach
aaacll
aaadaioba
aaadhkbkd
aaaedh
aaaeo
aaagcfji
aaagfgnoi
aaagnnil
aaahdo
aaahjbjj
aaahlepko
aaahpin
aaahpmkakc
aaajgkik
aaakagii
aaakjof
aaaoa
aaaoihm
aaaond
aaaoph
aaapeno
aab
aaba
aabahmk
aabbpf
aabcbekcl
aabcgl
aabchhgfk
aabfelo
aabfmfd...

output:

902435619

result:

ok 1 number(s): "902435619"

Test #28:

score: 0
Accepted
time: 820ms
memory: 9548kb

input:

99994
aaa
aaaaajgl
aaabclkj
aaabcnndo
aaablhdge
aaabp
aaachca
aaadpkgi
aaaeffeejg
aaaeo
aaafpd
aaagina
aaagjag
aaagnion
aaah
aaahillnnj
aaahnjfelj
aaaiblodcp
aaaj
aaakjiok
aaamogpc
aaanakpgfj
aaanefpeai
aaaondac
aab
aabcgn
aabcncfc
aabdnlpi
aabe
aabecckem
aabeefjm
aabeilddh
aabfhk
aabfpfp
aabhccij
a...

output:

662320487

result:

ok 1 number(s): "662320487"

Test #29:

score: 0
Accepted
time: 811ms
memory: 9396kb

input:

99993
aaa
aaac
aaacn
aaaejehk
aaafgpighb
aaagnbd
aaahmipjpe
aaaiik
aaaijei
aaaikkamai
aaakfchmg
aaakjnak
aaan
aaaokmfoc
aaap
aaapfeggnj
aab
aaba
aabafap
aabalae
aabbdag
aabbleddmd
aabdemg
aabf
aabgkjgc
aabgnboh
aabhggn
aabifac
aabk
aabklkm
aablbl
aablc
aabloajce
aabm
aabmc
aabmipmad
aabnfmld
aabnpcf...

output:

21324870

result:

ok 1 number(s): "21324870"

Test #30:

score: 0
Accepted
time: 869ms
memory: 9536kb

input:

99992
aaa
aaaaee
aaaagcag
aaaah
aaac
aaaciij
aaad
aaadlhoacc
aaaehlhae
aaaek
aaafapo
aaafe
aaahmippb
aaahobkfo
aaaiajcll
aaaing
aaajbkop
aaajebll
aaaloobon
aaampmmdlm
aaao
aab
aabbmfid
aabc
aabebcdcc
aabedhdama
aabekcok
aabhcgih
aabhmieilf
aabic
aabildfgik
aabjlalbnl
aabk
aabkf
aablg
aablojngjb
aabm...

output:

298518050

result:

ok 1 number(s): "298518050"

Test #31:

score: 0
Accepted
time: 817ms
memory: 9480kb

input:

99991
aaa
aaaajfd
aaabo
aaacnnpapc
aaacpngcb
aaadfcfian
aaaekfipmb
aaaelpnok
aaaf
aaafgekfh
aaagkkge
aaagpkkjom
aaah
aaahlj
aaai
aaaj
aaajfjog
aaakglbb
aaalaifmp
aaalh
aaalple
aaamelmd
aaamkbj
aaanfnh
aaaofemfbd
aab
aaba
aabaaghf
aababd
aabaogfmk
aabbammpfh
aabbdhkcfn
aabboeee
aabcgbo
aabckdog
aabea...

output:

738149247

result:

ok 1 number(s): "738149247"

Test #32:

score: 0
Accepted
time: 815ms
memory: 9472kb

input:

99990
aaa
aaaa
aaaalanik
aaaamplbl
aaabpagbd
aaabpllhg
aaac
aaaca
aaache
aaacijipfo
aaaemcpo
aaaglp
aaaig
aaajipmhm
aaajmphncp
aaakfnhcne
aaakkgoa
aaaknjbhng
aaalbm
aaamelpjec
aaamkbfmke
aaamocok
aaan
aaaodocjef
aaaoech
aaapgape
aaaphofg
aaapoimfhh
aab
aabaglbj
aabaoglp
aabbab
aabbgnjnh
aabbngfn
aab...

output:

311868864

result:

ok 1 number(s): "311868864"

Test #33:

score: 0
Accepted
time: 810ms
memory: 9484kb

input:

99989
aaa
aaaadn
aaade
aaafcgpipg
aaafhmpkbc
aaafka
aaagc
aaaifne
aaaj
aaakakblda
aaalhakph
aaallop
aaalmef
aaamofij
aaanacaf
aaao
aaaofccog
aaaoniecjh
aaapdc
aaapgpigm
aab
aabbpibl
aabchb
aabcoe
aabda
aabdagiei
aabe
aabep
aabfnjgf
aabgkfhfpc
aabgoljee
aabgonmeeb
aabhdlbnej
aabhldkkcc
aabhofce
aabik...

output:

359590216

result:

ok 1 number(s): "359590216"

Test #34:

score: 0
Accepted
time: 814ms
memory: 9268kb

input:

99988
aaa
aaaaklbcne
aaadlp
aaadnmfc
aaagfkpikc
aaahgkpm
aaahocbc
aaai
aaaijpchl
aaaka
aaakco
aaakhm
aaal
aaam
aaamog
aaan
aaanhnfegi
aaapggbdab
aab
aaba
aabancjjf
aabbimggc
aabblieicg
aabblm
aabdcig
aabdpkacp
aabeeglba
aabfcllbhk
aabfpco
aabgfbf
aabh
aabhh
aabibik
aabjdagpdh
aabjhaogf
aabjlo
aabkmc...

output:

910605341

result:

ok 1 number(s): "910605341"

Test #35:

score: 0
Accepted
time: 814ms
memory: 9424kb

input:

99987
aaa
aaaanjahgo
aaabe
aaac
aaadck
aaadhcpgf
aaadponl
aaaedeemf
aaaegnaf
aaah
aaahbaf
aaaiacl
aaajafkjeb
aaajji
aaajmm
aaalpbilod
aaan
aaapdeb
aaapeinge
aaapmh
aab
aabaflgcg
aabaindmnp
aabapkkofj
aabbhn
aabcm
aabdhnjcn
aabdlila
aabedhmhin
aabeh
aabfl
aabhl
aabimgil
aabjnpjg
aabjpaeid
aabk
aabl
a...

output:

240424831

result:

ok 1 number(s): "240424831"

Test #36:

score: 0
Accepted
time: 806ms
memory: 9408kb

input:

99986
aaa
aaaaekmbcg
aaaafia
aaaapn
aaac
aaacdkbp
aaackfikfe
aaaeo
aaagamjadc
aaagepnkb
aaagiab
aaagoon
aaah
aaaia
aaaihcpkm
aaaiiaac
aaaiob
aaajlobbf
aaakjdlde
aaaknaa
aaal
aaall
aaallj
aaaloaapfa
aaam
aaamhka
aaanhcg
aaao
aaapl
aabal
aabalj
aabapl
aabcacmljm
aabcicfgec
aabcpcdfha
aabejc
aabffgf
aa...

output:

331433634

result:

ok 1 number(s): "331433634"

Test #37:

score: 0
Accepted
time: 810ms
memory: 9308kb

input:

99985
aaaae
aaaahdb
aaaamap
aaabeid
aaabm
aaaccji
aaadlfgcb
aaaeejm
aaafaken
aaafjf
aaafpaecb
aaahm
aaaiolkj
aaaj
aaajag
aaajangcbf
aaal
aaalc
aaamaknpno
aaan
aaanbpdo
aaanpf
aaaol
aaaopcgbij
aaapa
aaapfjcdgh
aaapli
aab
aaba
aabbhcd
aabbkfafb
aabcj
aaben
aabf
aabfffkl
aabhnjii
aabibegf
aabifho
aabjh...

output:

764432302

result:

ok 1 number(s): "764432302"

Test #38:

score: 0
Accepted
time: 810ms
memory: 9428kb

input:

99984
aaa
aaaa
aaaahcknpc
aaaak
aaaamaiam
aaaamfgcml
aaabekf
aaac
aaaceabd
aaacigoc
aaadnbhic
aaaef
aaafbe
aaag
aaahcfldom
aaajfmp
aaakoe
aaalnma
aaamp
aaanan
aaanhjbk
aaao
aaapgfn
aaapmapfgi
aab
aabaj
aabbahbldo
aabcief
aabdgjk
aabdpfeea
aabe
aabei
aabelcj
aabem
aabeomfjl
aabffeggci
aabfklim
aabjjl...

output:

81244694

result:

ok 1 number(s): "81244694"

Test #39:

score: 0
Accepted
time: 811ms
memory: 9436kb

input:

99983
aaa
aaaaocm
aaab
aaabl
aaacin
aaacl
aaaclin
aaadeecgm
aaademmomc
aaadlje
aaaed
aaafikfl
aaagbjblfg
aaaghi
aaaghnbjd
aaagjfie
aaagmfdnke
aaahdnc
aaahm
aaaihkfbbk
aaajl
aaajn
aaakeaaem
aaakedjap
aaakgac
aaanfn
aaanjpoph
aaanob
aaaokcae
aabab
aababcc
aabaeem
aabaf
aabamccbi
aabbcbp
aabbhl
aabbiog...

output:

720412661

result:

ok 1 number(s): "720412661"

Test #40:

score: 0
Accepted
time: 802ms
memory: 9540kb

input:

99982
aaa
aaaalamb
aaab
aaabekjfa
aaabfl
aaabgg
aaadbdl
aaadoc
aaadpgjf
aaaf
aaafdcpj
aaafhop
aaag
aaagi
aaahgljpd
aaai
aaaj
aaajbb
aaajeg
aaakjfha
aaalg
aaalpp
aaamemlb
aaamgl
aaanbild
aaaocko
aaaoipfb
aaapg
aaapmncb
aaapofbebm
aab
aaba
aabafn
aabahe
aabao
aabbhe
aabblmf
aabcill
aabd
aabdbig
aabdck...

output:

562341742

result:

ok 1 number(s): "562341742"

Test #41:

score: 0
Accepted
time: 817ms
memory: 9400kb

input:

99981
aaa
aaaa
aaaaidbfkf
aaaaigmcnk
aaaao
aaabchnkbf
aaaca
aaacehkoid
aaadnjb
aaaefg
aaaencim
aaaf
aaafdkm
aaah
aaahigogjh
aaahn
aaahngnclm
aaainlde
aaaknkmhij
aaamfkbpda
aaamkhoded
aaanjikh
aaaoekllji
aaapdaoine
aaapgoich
aab
aabblh
aabddclb
aabddgdc
aabepjg
aabgcoldf
aabghhmkl
aabgnbh
aabgpjfed
a...

output:

517952580

result:

ok 1 number(s): "517952580"

Test #42:

score: 0
Accepted
time: 806ms
memory: 9600kb

input:

99980
aaa
aaaakodoae
aaadfegko
aaadfekg
aaadlk
aaadoobmom
aaae
aaaebica
aaaggkb
aaah
aaahadfe
aaajlhnh
aaakooc
aaal
aaaldg
aaalec
aaalhohj
aaali
aaaljape
aaamdfloln
aaamfnho
aaamjmmbh
aaammmpcc
aaanhfb
aaanj
aaanjaj
aaaogcdgp
aaap
aaapbpi
aaapkhfjll
aaapkih
aab
aabad
aabbbj
aabbodoaik
aabbpikh
aabcb...

output:

17075492

result:

ok 1 number(s): "17075492"

Subtask #3:

score: 34
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #43:

score: 34
Accepted
time: 809ms
memory: 9236kb

input:

100000
AAAAOp
AAALkO
AAAaek
AAAo
AAB
AABIPDEDlE
AABJK
AABKck
AACBaBdfAf
AACPKonI
AADFgindcL
AADaFggPmB
AADamAhdl
AAE
AAEFlfkfcN
AAFBHjK
AAFClf
AAFOGeH
AAFbBJ
AAFhJc
AAFnFmB
AAGN
AAGgGioiG
AAH
AAHDHb
AAHeIjic
AAI
AAIHdLa
AAImDja
AAJBejD
AAJHjC
AAKOG
AAKc
AAL
AALHanIghO
AALJK
AALPnGOOCD
AALp
AAMF
AAN
...

output:

897194690

result:

ok 1 number(s): "897194690"

Test #44:

score: 0
Accepted
time: 816ms
memory: 9416kb

input:

99999
AAAAoppb
AAAPdLeAdB
AAAmaP
AABB
AABFDa
AABGGpfBfd
AAC
AACKG
AACd
AAD
AADDIiCbFP
AAEGKoChhD
AAEIgjHK
AAEP
AAGJnm
AAIGJJp
AAIH
AAIcneG
AAIelpPMEf
AAIiG
AAJAdFN
AAJCg
AAJOk
AAJcGF
AAJeiOJl
AAJhlKdlo
AAKfCha
AAKfenbHA
AAKgHEbO
AAKiGaIBBo
AAL
AALO
AALOkOl
AALedK
AALfhknnIp
AALoGhp
AAMJcJ
AAMO
AAMPF...

output:

273555599

result:

ok 1 number(s): "273555599"

Test #45:

score: 0
Accepted
time: 810ms
memory: 9348kb

input:

99998
AAA
AABAlnoAJ
AABBffCde
AABLFLiCj
AACEbm
AACFjd
AACM
AACNAdo
AACOnlDg
AAD
AADEgoCAo
AADd
AADecMOhL
AADhhpl
AADkMk
AAEBef
AAEEhfmbOP
AAEJKoLCE
AAEOfGkdK
AAFKlDl
AAFPANILk
AAFbOL
AAFe
AAFiNnmb
AAFpgaJ
AAGpE
AAHCMG
AAIFEkAK
AAIHGpPL
AAIhihJHn
AAIkd
AAJCGCO
AAJJK
AAJek
AAJhNgCkiH
AAK
AAKGFo
AAKaOl...

output:

886806378

result:

ok 1 number(s): "886806378"

Test #46:

score: 0
Accepted
time: 809ms
memory: 9268kb

input:

99997
AAAAnCec
AAACbLjFOo
AAAcmPM
AAAdJKDA
AAAhobji
AAAlmfmDAI
AAB
AABDFdc
AADoMhbaO
AAEhGolIP
AAEpgBlK
AAFIpeAmn
AAFJ
AAFjgHioJB
AAGFECgB
AAHmja
AAIFAJALIE
AAIHgBHk
AAINhEN
AAIbNFiHpi
AAJCEC
AAKKP
AALcMJ
AAM
AAMFfGgEk
AAMOPECb
AAMbK
AAMd
AANf
AANfl
AAOIGHcD
AAOgkcaBGC
AAOldd
AAPPphBb
AAa
AAaBO
AAao...

output:

570626020

result:

ok 1 number(s): "570626020"

Test #47:

score: 0
Accepted
time: 826ms
memory: 9376kb

input:

99996
AAA
AAADnFpMK
AAAMdHAPf
AAAolNP
AAB
AABK
AABKmfM
AABblPH
AABbpcJ
AAC
AACG
AACGjeBE
AACHbmN
AACc
AADMJ
AADMMGi
AADNgJ
AADPAGBImD
AADlHeD
AAEiECK
AAFGLfHeO
AAFHOlE
AAFJkhN
AAFiL
AAG
AAGANBN
AAGk
AAIeaAn
AAJDJDn
AAJei
AAJpGoeE
AAKIcd
AAKKC
AALH
AALOplo
AALPPNK
AALpbi
AAMPM
AAMfGLc
AANF
AANFBncCe
...

output:

218645051

result:

ok 1 number(s): "218645051"

Test #48:

score: 0
Accepted
time: 806ms
memory: 9280kb

input:

99995
AABEgodog
AABbaGcAMK
AABdbdcceD
AACJ
AACkgmi
AADgpiJje
AADkmcBk
AAEPAnbP
AAEcCL
AAEfGFM
AAFHjeo
AAG
AAGadjanje
AAGppGoBng
AAH
AAHafeifP
AAHfElIF
AAHmdKfPaG
AAIOlde
AAIPkPNE
AAIlhFAHd
AAJEf
AAJKObmPL
AAJfkmkk
AAK
AAKJhJ
AAKKlGPh
AAKPAMi
AAKbiPMolC
AAKnKO
AAKocJp
AALAMJjEaH
AALJLeloc
AALLIbLN
AA...

output:

562606635

result:

ok 1 number(s): "562606635"

Test #49:

score: 0
Accepted
time: 812ms
memory: 9208kb

input:

99994
AAAACjo
AAAcI
AAAifMHE
AAAnkB
AABHMN
AABdoJMCPo
AABh
AABkiaEfEo
AACJb
AACdEjh
AADOhfFK
AADojhfLh
AAE
AAEGpo
AAEKPIAc
AAENADm
AAF
AAFFbaoNfc
AAFah
AAFcOBOF
AAFpFIOLG
AAGO
AAGifeO
AAGljM
AAHgbf
AAHib
AAIBO
AAIFngb
AAIMCPE
AAIe
AAIiEK
AAJ
AAJOedB
AAKeADJM
AALBCO
AALNHinDcJ
AALbFO
AALoMip
AAMELfCm...

output:

173687122

result:

ok 1 number(s): "173687122"

Test #50:

score: 0
Accepted
time: 805ms
memory: 9192kb

input:

99993
AAAeNOm
AAAjO
AAB
AABknI
AACClmEb
AACIPGPHJc
AACof
AADklB
AADkpF
AADpKJBnN
AAE
AAEDkfh
AAFBIdhJC
AAFOIn
AAFnKOeEln
AAGJEEnH
AAHJHEJc
AAHilG
AAI
AAIAbL
AAIBMDJ
AAIi
AAIn
AAIp
AAJGpoPDkc
AAJK
AAJbpAgLM
AALDB
AALP
AALopa
AAMEpfAE
AAMLkHlohF
AAMja
AAMmelF
AAMohK
AANEML
AANG
AANJBKM
AAOKAC
AAOj
AAa...

output:

469483777

result:

ok 1 number(s): "469483777"

Test #51:

score: 0
Accepted
time: 809ms
memory: 9252kb

input:

99992
AAAAjdo
AABP
AABa
AACLbC
AACPhl
AACcp
AACjmB
AADIahb
AADMOiIn
AADanoim
AADneoLc
AAE
AAEAMd
AAEh
AAEiiJGGmG
AAElLa
AAFM
AAG
AAGGkI
AAGd
AAHCkbKIn
AAHJbFdiG
AAHLDbKlI
AAHbPJAGg
AAI
AAIMbEp
AAIoHhaeI
AAJOKL
AAJcjbHi
AAJhjmfF
AAJjA
AAKE
AAKLN
AAKecfd
AAKlkpeBbe
AALJkC
AAMFjJkjmC
AAMLbiEE
AANLD
AAN...

output:

906466336

result:

ok 1 number(s): "906466336"

Test #52:

score: 0
Accepted
time: 805ms
memory: 9412kb

input:

99991
AAA
AAAFgNIj
AAAJAe
AAAphK
AABHCPmCFL
AABjhfGHaL
AACPMe
AACdnejeg
AAD
AADIA
AADgPE
AAE
AAECa
AAEF
AAEFDHOL
AAENhNFfj
AAEPbPlN
AAFP
AAFeG
AAGIk
AAGeOm
AAGgemkNC
AAGkbhnJ
AAH
AAHDACKEJi
AAHEpGdDIO
AAHKAJmn
AAHjFkcoG
AAIFfdfabo
AAIcOfGJ
AAJ
AAJEDicCPH
AAJdpKkccm
AAK
AAKALknlm
AAKKgMLIB
AAL
AALAgg...

output:

607181291

result:

ok 1 number(s): "607181291"

Test #53:

score: 0
Accepted
time: 833ms
memory: 9340kb

input:

99990
AAADAhF
AAANgEl
AAApFgOjb
AABABIKEmM
AABAk
AABJMCpiPk
AABbdHleF
AABpNOHk
AACoekDNNN
AADBldM
AADGAijE
AADMADoh
AADjoJK
AADnciFD
AAE
AAEI
AAFGnmeOG
AAFNlMgce
AAFkEpPD
AAGBMgO
AAGECpEJj
AAGFaihpl
AAGmdMPGg
AAHKOpd
AAHgpKChf
AAI
AAIIenIm
AAIPjh
AAIfgPfKEI
AAIm
AAJDb
AAJhAIJ
AAJn
AAKFfjfkpN
AAKjpl
...

output:

114802953

result:

ok 1 number(s): "114802953"

Test #54:

score: 0
Accepted
time: 816ms
memory: 9400kb

input:

99989
AAA
AABEpAfhi
AABKOJ
AABaPKgpKH
AABpJAK
AACCJGo
AACNj
AACoNpO
AADKDcEI
AADamnK
AADhkKi
AAEEcgbin
AAEJ
AAEL
AAG
AAGJ
AAHBHGoGnp
AAHdhP
AAIC
AAIkI
AAIp
AAJF
AAJeLbJecm
AAJjLN
AAJmkoIa
AAJn
AAJoOMCd
AAJpjKAg
AAK
AAKIP
AAKPn
AAKaaJc
AAKp
AAL
AAMMBL
AAMPchGcj
AAN
AANJOLEHFb
AANLd
AANkdJDg
AAO
AAOlk...

output:

88466783

result:

ok 1 number(s): "88466783"

Test #55:

score: 0
Accepted
time: 812ms
memory: 9224kb

input:

99988
AAAB
AAAa
AAB
AABGENNk
AABfLg
AAC
AACACm
AACBmmJI
AACbpo
AACgMb
AACpN
AAD
AADBlHndOH
AADGIblJH
AADIm
AAEEjJOB
AAELnLGGH
AAEOdiBfl
AAEklCKe
AAFD
AAFG
AAFKCDom
AAFf
AAGGonBocE
AAGgipNdp
AAH
AAHJjhf
AAHafj
AAHd
AAJK
AAJpACegM
AAKgOmdD
AAL
AAMPL
AAMnMNoB
AAMoh
AAN
AAOD
AAOG
AAOlppbM
AAPGLhfBbp
AAP...

output:

216884355

result:

ok 1 number(s): "216884355"

Test #56:

score: 0
Accepted
time: 818ms
memory: 9420kb

input:

99987
AAAHo
AAAgNGmA
AAAmDdiCkf
AAB
AABDam
AABao
AABm
AABmaD
AACmm
AAEKJGnAhd
AAENHEbNL
AAEPlBBF
AAG
AAGNJIB
AAGNKlHCJ
AAHN
AAHOGEk
AAHcIgLb
AAHiJdC
AAI
AAILhBLHEg
AAIlO
AAJPHiInkF
AAJj
AAKDdD
AAMAHp
AAN
AANCp
AANEjaolGG
AANFjJIKFd
AANg
AAOImDKg
AAONIFKl
AAPGc
AAPLj
AAPP
AAa
AAaLCN
AAbAM
AAbNhC
AAc
...

output:

195235477

result:

ok 1 number(s): "195235477"

Test #57:

score: 0
Accepted
time: 813ms
memory: 9220kb

input:

99986
AAA
AAAI
AAAdHjGeA
AAB
AABCcpmehD
AABCm
AABpLEcG
AACAh
AACFGoGh
AACKPoFFP
AACNo
AACnc
AAD
AADHa
AADbmkbjhE
AAE
AAEljGgo
AAEn
AAEnOJaGp
AAF
AAFBKjJk
AAFNNA
AAG
AAGccknCAC
AAGknJImK
AAH
AAHCG
AAIaIgJG
AAIpMdg
AAJ
AAJgJEOmnA
AAJhLfMnk
AAKeon
AALB
AALCdEH
AALFAI
AALJbnl
AALNdC
AALh
AALjiMo
AALpJOm...

output:

659184196

result:

ok 1 number(s): "659184196"

Test #58:

score: 0
Accepted
time: 829ms
memory: 9288kb

input:

99985
AAA
AAAJE
AAAJpbmG
AAAhkpBhj
AAB
AABJBglP
AABNjF
AABc
AABpPiDEB
AACMH
AACP
AACPlCg
AACiGkkna
AACpC
AADHFDGkO
AADMapN
AADNm
AADmMl
AAE
AAFdmiiIn
AAGHepPj
AAGIJe
AAGKGOIpe
AAGpMGjDHB
AAHHJcm
AAHeo
AAJDipDnh
AAJFA
AAJONPaDP
AAJPaA
AAJckbM
AAJpDeb
AALa
AAM
AAMAfNhcIc
AAMFkfgmcd
AAMcbBA
AAMdKfA
AAN...

output:

407591000

result:

ok 1 number(s): "407591000"

Test #59:

score: 0
Accepted
time: 813ms
memory: 9208kb

input:

99984
AAA
AAACcblG
AAAgAb
AAAliJFG
AABgenMgOL
AABoP
AACcKNB
AACdjCFmG
AAChLC
AADInb
AADKI
AADcAfgFO
AADoL
AAEEoNlIJc
AAEKlc
AAEMdIEo
AAEPC
AAEd
AAEkHpmhFl
AAFbFJFPLD
AAG
AAGHD
AAGnjFNjb
AAHm
AAI
AAIAebkhb
AAIHNdk
AAIKH
AAImOPOAae
AAJLbNPjE
AAJcda
AAJdjkPal
AAK
AAL
AALP
AAM
AAMM
AAMPEPLkIB
AAN
AANfBa...

output:

177680271

result:

ok 1 number(s): "177680271"

Test #60:

score: 0
Accepted
time: 818ms
memory: 9264kb

input:

99983
AAB
AABf
AABlnokgMH
AABoDo
AACEF
AACHKA
AACNF
AAClgJJo
AACm
AADAhdMOE
AADMneDK
AAEbPmIc
AAFBLle
AAG
AAGELBei
AAGFPH
AAGHBBfhH
AAGP
AAGaoOJ
AAGb
AAGomogL
AAHfCHkhi
AAIGE
AAIMIn
AAIOElPm
AAJFMGeDEF
AAJe
AAKIJoEC
AALKA
AALmGbPedJ
AAM
AAMAmaaHCj
AAMHGaiO
AAMHaKfhMJ
AAMO
AAMb
AAMp
AANfaidFG
AANhejJ...

output:

852492541

result:

ok 1 number(s): "852492541"

Test #61:

score: 0
Accepted
time: 802ms
memory: 9296kb

input:

99982
AAAHn
AAALH
AAAN
AAAOnCpOP
AAAoMfMpb
AAB
AABdob
AAC
AACAFg
AACcmo
AACeCBGhH
AACgOAF
AADPB
AADkcC
AAECpGnjHo
AAEJ
AAGABmlnNF
AAGAKEMNNE
AAGCLm
AAGNhckmKN
AAGaKn
AAHGnj
AAHJM
AAIaAP
AAIifgAdFo
AAJLBCf
AAKAd
AAKCA
AAKCl
AAKeNc
AAKjKijH
AAL
AALDj
AALeB
AALk
AALpFLBggk
AAMFHPED
AAMM
AAMMObH
AAMlCNm...

output:

830859029

result:

ok 1 number(s): "830859029"

Test #62:

score: 0
Accepted
time: 815ms
memory: 9116kb

input:

99981
AAAA
AAAO
AAAh
AABJ
AABdieoKc
AAC
AACGd
AACg
AAChEKlkH
AACl
AAD
AADApnnPG
AADC
AADKbf
AADigiPGi
AADndLa
AAFED
AAFFeCDoA
AAFhAEAehD
AAGOF
AAGbEmPO
AAGdEi
AAGi
AAHC
AAHJBKDGGj
AAHN
AAHoMLGo
AAI
AAIBHBcMk
AAIPlbPdPF
AAImEe
AAInpGh
AAJHeJol
AAJKClK
AAJLN
AAJPojpn
AAJboGIC
AAK
AALEIdIo
AALeNiJ
AALi...

output:

752156719

result:

ok 1 number(s): "752156719"

Test #63:

score: 0
Accepted
time: 807ms
memory: 9340kb

input:

99980
AAAFdMKBi
AABJMio
AABaAbnNLc
AACkhbOdLh
AADGOpcE
AADHDgON
AADfj
AAE
AAEf
AAEpOdCC
AAFA
AAFAg
AAFFF
AAFNkgldl
AAGBdegbDK
AAGdginN
AAHLlFOHk
AAI
AAIFJG
AAIoafgJaf
AAJ
AAJKhiAMe
AAJhp
AAJoh
AAK
AAKHgA
AAKMipooB
AAKp
AALfMcPB
AALlBeOlFa
AAM
AAMAolg
AAMPjL
AAMlID
AAMngCa
AANLGn
AAOBk
AAOceFLCDH
AAO...

output:

644577167

result:

ok 1 number(s): "644577167"

Subtask #4:

score: 16
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #64:

score: 16
Accepted
time: 810ms
memory: 9196kb

input:

100000
004GiBKC3
005n
009
009I64
00B
00C
00CMVzR
00FDXQe
00HyUQ3j
00Mt65H
00NoQf
00QsXj
00V5B19hr
00VIh
00VN9On
00VqP
00Wg09jL
00Y9ZxY5
00Yc
00ZPZ
00ZYQcuN
00aRRbwi
00aaW
00l
00qt2sx
00w6
0137RNAvTK
0163VJz
017gPMEm
019xSB
01AHBFjWXd
01Ee13dbT
01GkH
01Imkm3cL
01LEqdDkjG
01Q
01RGxb
01T65TD55
01aP
01b...

output:

67487127

result:

ok 1 number(s): "67487127"

Test #65:

score: 0
Accepted
time: 815ms
memory: 9180kb

input:

99999
00266GY
003W7Y
006
007sX
00HLM
00KpB
00Kw5mWPbX
00MU
00Ncx8
00P7k64
00PKZndZ
00PQ
00QvDHXF
00e2xG
00eP
00p
00qL2
00rPJyK
00trDw
00x7NZd
00yihUzM
010wvDdK
011sag9
013
013eB3DNM
013yx9fr
014CBXw2qf
014lw7Az
016fL5XvQi
0182a
019nhUGwTi
01DAxaB17p
01EJe6Zu
01H
01NE
01OZCjThfT
01Oe
01TJGq8
01UQkrls...

output:

98957861

result:

ok 1 number(s): "98957861"

Test #66:

score: 0
Accepted
time: 801ms
memory: 9236kb

input:

99998
000Otia
003
005
00BiqI
00EDQ0
00EJI
00ETiTMF84
00Hj7L
00Iu9
00LS8TmAW6
00MuA028e
00Q62btcJE
00TSxQ6AKJ
00Y2eIk7d
00gWMF
00jZ
00jrUsk7x
00lmF
00n
00t
00wh5MPHl
00ygmjV2
00zCrrvx
011TBbx
014epT9bS
015WQsxb
015pRkEAf
017EqkJn07
01A4efX
01A9xgMz
01E9mc
01EOV4VH
01Hf1Tq
01JhZFnY
01N4EH9ZXK
01S306a
...

output:

292913973

result:

ok 1 number(s): "292913973"

Test #67:

score: 0
Accepted
time: 811ms
memory: 9484kb

input:

99997
000Hn
0011OCj5a
006Bll2hC
00F43B
00Jzb2
00PQwMP
00UE
00X
00XHXljQTf
00coSv
00k
00kCZFWf
00lGKo
00q21Tgc
00sbQm
00tKr2E2is
00zGB
00zRpL4v
011
01BnHmyazj
01CT
01Dui
01E2E3jle
01GTpwve
01Gh
01Ghkgk
01I
01OK
01Rj7
01TzP
01UGn
01XvgBuL
01ZXF1
01a
01cqZy
01dhLLI
01h5f5
01ixOJc
01nwW9
01oHIT
01oWyz
0...

output:

304635403

result:

ok 1 number(s): "304635403"

Test #68:

score: 0
Accepted
time: 852ms
memory: 9352kb

input:

99996
001T7NfHt
005Uv
007SXil7E
008Dzob
00ApzclY9k
00DnRi
00G
00M5X
00MNTBJrYb
00MdUBCVk
00Psi
00Y
00ZE6YfWf
00Zj
00asu1N
00bdBjH9n
00f7
00fpY
00j
00jfqw8jLJ
00lNx
00lxeQ
00s2A
00vZIdU
00yfoFpsyf
010t2adZ
010zboj3v
013NnLU
015J
016CT
016IoyyMV
019Ti
01AHN
01E
01GoJS1d
01N
01U9iC
01V
01VaBqlz
01b58jr...

output:

240486407

result:

ok 1 number(s): "240486407"

Test #69:

score: 0
Accepted
time: 820ms
memory: 9248kb

input:

99995
001m8J
003nUHLnB
005do
008FE832Y
00A
00MJG5se
00SeT
00WAxSDcR
00Xj8Oy7wU
00a
00bvDU
00dOyh
00h
00hlVzKt
00i
00i12
00iGeti
00k
00oUdTdn
00qgrk9Wp
00yt9G
012
013kqOGmk
019Zk2
01A4i
01Frf2
01IFKXMN8D
01J
01JTPrx6
01KJm
01LVSz2Sn
01LlkA
01LonFZu
01NfOix5p
01Nq
01P4krLX4
01RJMuuw
01Uw
01WSpjaQds
01...

output:

731772743

result:

ok 1 number(s): "731772743"

Test #70:

score: 0
Accepted
time: 824ms
memory: 9208kb

input:

99994
000MBO3LhD
001RPXoPp
003vxtsu
007TZ6my0
00816Azw
008VKHB
009KqbDNRK
00KwV
00LgURF
00M9BU
00R1
00RtQ
00Wr
00XLNFHsWJ
00YJdnXPIp
00ZgqcOoS
00fU8XeS
00k
00mrA
00tXM87W
00x5Kw22GX
010eoomJ6
018
018FgC0
01AGD
01B9qdju6B
01FuTf4u
01JjWajErQ
01MEe
01NCicUpY
01NTr
01OU
01OiVK
01T7dR25uk
01VA
01VGa
01W...

output:

660919420

result:

ok 1 number(s): "660919420"

Test #71:

score: 0
Accepted
time: 824ms
memory: 9392kb

input:

99993
000
002e
004kgUY
005
005PY7Ko
008CEA
009
00AsLI
00BOiR4x
00C
00EZtFcfmv
00J
00JeMB9
00JsTnnKtW
00N
00NrFZefb
00TptSR
00YOpmpGo
00Ym
00bu
00c
00cRz0
00gTzBkX
00hOPCF
00hu5T
00oOBI0us
00rJ
00ruybZl4b
00t
00xKA2UhWi
00zRDUnZ
00zd3n0kG8
011gF
012
015s
01BM
01CBt
01Djk003AC
01MpF
01PxWfClBa
01TE
01...

output:

995260675

result:

ok 1 number(s): "995260675"

Test #72:

score: 0
Accepted
time: 815ms
memory: 9212kb

input:

99992
000o
001bsJn0m
004
008
00C
00F
00GU1TMd
00HfQPh
00JAxarS9
00JP
00PbK0bP5W
00cw6
00d9O
00dSy
00e
00hWX400
00kiMNxGUQ
00oAlBWbcO
00oreLPdd
00s4O
00tqgQrD
00ujos2
00v
00vXYlV3a
013iuI
016JB
017
01Bm4yjY8y
01C
01DiiIW6
01Diwr87
01FVgzB
01GrwDMT6k
01Hhk
01K9hahn
01KgdlCi7
01UEKXNR
01W1Gd6wI
01WXGy
...

output:

129760923

result:

ok 1 number(s): "129760923"

Test #73:

score: 0
Accepted
time: 831ms
memory: 9396kb

input:

99991
001
00CDHT
00GCi92
00HvCp0
00KEa6ihS
00OnWV
00UTTdb
00VzA
00YAUSCrrX
00c
00ffv0B
00gWpL
00hS2VdS
00jhqNI6i
00ppCw
00r
00ujxEu9Wf
00v5j
00x
00yG1XlEMy
010UdiPAcW
011UgR
019INZG
01B
01B2
01Dng
01FZ7
01GIrpdo1i
01HZL4kgxh
01LkIb3
01NgGJaiEW
01UZRc8M
01bJtF4
01c8sZEB
01cQ
01g
01gxZLW
01hD3
01hKTXu...

output:

991331805

result:

ok 1 number(s): "991331805"

Test #74:

score: 0
Accepted
time: 813ms
memory: 9340kb

input:

99990
00014Nw
0024mETOKn
005
007zSJ
00BCXkyd
00BPF
00D2CRy
00DNnbxH
00GJoa
00HbUZIW0
00HzoAQ8A
00O1
00OItCEYz
00Uih
00UumcpMCD
00Z
00bKLg9B
00e
00es
00fP
00fSK9
00fyXTDz4W
00gzqA
00jNOEeLg
00kZuaW
00nHR2FyJT
00rIevD8
00zpx2BBa
010E
010xBreI
011H7Dmq
015
015o8jFUq
019qoSFL
01AxdGl3
01C0MNJ
01D
01DaGt...

output:

983101424

result:

ok 1 number(s): "983101424"

Test #75:

score: 0
Accepted
time: 812ms
memory: 9240kb

input:

99989
007MAr
007oqE8zlm
00B
00EqXIOq
00GJI
00GPkyyzB
00Ij
00K
00LAYCV
00M3Aud
00O
00Rz
00TYW31
00g
00i6
00ik21yp5
00rnY5g3a
00w
00x
010rB5
0139Ux
0151hc8ynf
01ES1
01EVb
01Eilk
01Fp51
01GP95
01HKhH
01R
01VYjYR7
01awsWNXPh
01dVql3CCH
01eqmavJ
01hLb5BQR
01jw7
01qPHS7E5O
01sGebz
01u33H
01x
01xZb
02AY4b
...

output:

248798209

result:

ok 1 number(s): "248798209"

Test #76:

score: 0
Accepted
time: 816ms
memory: 9296kb

input:

99988
001
001zKuiz
002SQcTI
0056YV0
007
008H4B
00BAHdVx
00F
00G81E
00N
00Oi6J662
00Puwd4pT
00QBUz5jz
00RqHvh
00UkfXsyLT
00Yh
00ZPg0R
00d3t4qQHf
00f0
00fg9nZGB
00hfpeyUx
00lqKS25
00u2O
00uB7RXiE
00vZfJ3
0102
0128E4Q
0149N
015ftKu2wV
016XYgH
018W
019qsTD
01DJUEsAae
01Dann4aAj
01EQ
01H7
01JMoThH
01Jp
0...

output:

344484930

result:

ok 1 number(s): "344484930"

Test #77:

score: 0
Accepted
time: 818ms
memory: 9200kb

input:

99987
000vkdZ
001OTuSOt
008fPGyO
00E037nnt1
00FkPd5a
00KpGHO
00OA
00Xuu3GM
00eYbwq
00fEEj
00j
00k5P5KF6o
00oBkdSq
00tRB
010A8w
0110
0147F
016z5j3q
0194k9k1
019GyQ
01B6ogzk
01Bm
01CFGq9p
01Cqko
01D8u0w
01EVYds
01JUZJr
01Mp
01P6HA
01PKzkT8c3
01PRIb
01RuylDMNN
01U
01UC
01eE7
01hNP7d
01j
01kJ4QtiJ2
01mD...

output:

897003530

result:

ok 1 number(s): "897003530"

Test #78:

score: 0
Accepted
time: 810ms
memory: 9368kb

input:

99986
001CVUd2
004n7Og
009IZ8joJ
00A4PI
00AH4Q3c
00F3
00FDJehX
00GGM
00Ip1WHy
00Jdc67m
00KdXDGm
00LwON2FS
00NO
00OLV
00OxOg
00RPGDuXy
00UK3OU1
00UV
00VF
00WLUMc8
00Y
00YHCq5p
00ckIb7HX
00d1bPcf
00e5cH6
00g
00gbhnJY
00hw2qX
00i
00j2nKsb
00mg
00qlKlloo
00sZI0
00tOcf
010YHlN
011KzLzKxV
011a
014Oy
015
0...

output:

82964789

result:

ok 1 number(s): "82964789"

Test #79:

score: 0
Accepted
time: 813ms
memory: 9424kb

input:

99985
0011EUkmDG
001euplP
001lcTB
006h
00Epkse
00NPPW
00OFxp6OYk
00RRCOqt
00U
00X9Ziw
00Xs
00YvRk
00aqlatS
00b79K
00cMO9h
00d
00dntdA2I
00fjyx
00gM3
00h9Sjn
00l
00tKiYj
00v4bpgZ
00x
00xyKEw3
00ylIu
011uFF
016vjimh3
0175o7AG
018bj
01IQ
01IQaFf3tc
01JqaXI
01Lqz
01MZE
01RVrMvUXO
01W66QGhw
01XFqq
01Y
01...

output:

156615179

result:

ok 1 number(s): "156615179"

Test #80:

score: 0
Accepted
time: 831ms
memory: 9184kb

input:

99984
000
005
006b
006btZ38WE
006wP
00AW
00Bkvo4nF
00CbA
00Fn7gjM
00HwJ2
00Olo7
00R5z0qM
00TPtG
00UJc3
00XjNBhgHM
00XvD1O7
00Z40wwdc
00altDcSA
00f0x
00gp
00l7aU2R
00meFP0o
00muQ4X
00n
00oB0Yclu
00oIdXm7
00pL
00tCGm
00vXt
00yVnt
011e87fPH8
013aUc
013g
016C2v
017bohoH8U
018
01DcjrYcM
01DlrNB8G
01Gr5bS...

output:

128770308

result:

ok 1 number(s): "128770308"

Test #81:

score: 0
Accepted
time: 818ms
memory: 9340kb

input:

99983
001pwi1aMT
002mmo8kEV
006RObw
00BPs
00CVKBnivu
00Gh0yWA
00ICkW5mt
00MNkUQT
00NB
00OMZMSNk
00VILnZ1G
00VNB
00Z3S
00ZkyZzz
00adFAfK
00ck9o
00doCNApb
00dwp
00g
00iSZ8A
00ilxCdW1G
00jT
00oVf
00p3K5o
00qy9YPE0
00uu
00w3dEjLz
00w5ebT2
00x8Q8
011UvJV
015
0162lXBd
01759Wma
0179
01A1
01JEHi2
01Kyxd
01S...

output:

960764834

result:

ok 1 number(s): "960764834"

Test #82:

score: 0
Accepted
time: 809ms
memory: 9224kb

input:

99982
001wIueCN
0034NgeHm
0059rQCe
005G5BhF9N
0064jKn
00BM
00CAfCp
00IVcc
00IaFe
00L6Sg0Kx
00LEk
00NL
00SCQrv
00Sv0bNXw
00WuF2i
00aKtjHa3P
00ci0K
00gIuQ
00l1KD
00nO2D
00q1
00rgu
00w
00ynu
013XK
01A
01DQaQvSS
01FUJHETD
01H9KjFNG
01Ku
01LW
01OG5ycF
01Q
01Q9H4aa
01TwR
01U
01UVnBs
01XiAoZSQf
01ZoD
01enT...

output:

588220956

result:

ok 1 number(s): "588220956"

Test #83:

score: 0
Accepted
time: 811ms
memory: 9368kb

input:

99981
0005oy
003
004Y
007sm
00FHTi
00IRh28F
00JXCX
00MfZ0
00NiRyar
00Ns5ixNF
00W
00W3
00X2oVIhxv
00dFMxaDvE
00e4Bgb
00gT01RX
00h
00hOkH
00krKWhYH
00ljTd9gY
00lkJKjrqw
00qKr
00rLisaKV
00s
00ttoUB4De
00xDOj
00ykBu7L
00zhkHuAx
012U9inz
016
019O
01G9R
01K
01QDp6
01SV2TE
01YdrQRgBS
01dq4cmw6Y
01fj3sS
01m...

output:

984695865

result:

ok 1 number(s): "984695865"

Test #84:

score: 0
Accepted
time: 818ms
memory: 9220kb

input:

99980
002
003
00A8tugjoF
00DzBOmC
00F
00HJyfcQuX
00HWI
00KPTf
00R0cnH
00dPyE
00eV
00iz44VT
00laMMgx2H
00lzNV
00p
00pBkJRy
00q
00uNQWX
00umaq5rW
00ymuRJ5S
00zeAOMCmB
00zfb
013j
01DDn0
01DitYbYI4
01Gfk
01Jt
01KtiBko5W
01MMUM7
01O7
01OJINb
01Om
01PQvWTa4c
01SGtquPo
01T
01UPZY
01V
01VsAdv
01amCVK
01d6
0...

output:

195497079

result:

ok 1 number(s): "195497079"