— This is not playing but duty as allies of justice, Nii-chan!

— Not allies but justice itself, Onii-chan!

With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they've never reached — water-surrounded islands!

There are three clusters of islands, conveniently coloured red, blue and purple. The clusters consist of ab and c distinct islands respectively.

Bridges have been built between some (possibly all or none) of the islands. A bridge bidirectionally connects two different islands and has length 1. For any two islands of the same colour, either they shouldn't be reached from each other through bridges, or the shortest distance between them is at least 3, apparently in order to prevent oddities from spreading quickly inside a cluster.

The Fire Sisters are ready for the unknown, but they'd also like to test your courage. And you're here to figure out the number of different ways to build all bridges under the constraints, and give the answer modulo 998 244 353. Two ways are considered different if a pair of islands exist, such that there's a bridge between them in one of them, but not in the other.

Input

The first and only line of input contains three space-separated integers ab and c (1 ≤ a, b, c ≤ 5 000) — the number of islands in the red, blue and purple clusters, respectively.

Output

Output one line containing an integer — the number of different ways to build bridges, modulo 998 244 353.

Examples
input
1 1 1
output
8
input
1 2 2
output
63
input
1 3 5
output
3264
input
6 2 9
output
813023575
Note

In the first example, there are 3 bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is 23 = 8.

In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, respectively.


  题目大意 有3个群岛,每个群岛中有一些互不相同的岛屿,现在建一些桥,使得同一群岛内的两个岛屿要么不连通要么最短路至少经过3条桥。给定三个群岛包含的岛数,求合法的建桥的方案数。

  显然有某个群岛中的某个岛只能连接其他群岛中的一个岛。群岛与群岛之间的建桥互相独立,所以考虑分开计算。

  考虑两个群岛之间建立k座桥,那么方案数就是

  所以对于两个群岛之间的建桥方案数for一遍就求完了,最后把答案乘起来就行了。

Code

 /**
* Codeforces
* Problem#869C
* Accepted
* Time: 30ms
* Memory: 0k
*/
#include <bits/stdc++.h>
#ifndef WIN32
#define Auto "%lld"
#else
#define Auto "%I64d"
#endif
using namespace std; #define ll long long void exgcd(ll a, ll b, ll& d, ll &x, ll &y) {
if(!b) {
d = a, x = , y = ;
} else {
exgcd(b, a % b, d, y, x);
y -= (a / b) * x;
}
} ll inv(ll a, ll n) {
ll d, x, y;
exgcd(a, n, d, x, y);
return (x < ) ? (x + n) : (x);
} const int moder = ;
int a, b, c; inline void init() {
scanf("%d%d%d", &a, &b, &c);
} long long calc(int x, int y) {
long long rt = ;
long long Px = , Py = ;
for(int i = ; i <= x && i <= y; i++) {
Px = (Px * (x - i + ) % moder) * inv(i, moder) % moder;
Py = (Py * (y - i + )) % moder;
rt = (rt + (Px * Py % moder)) % moder;
}
return rt;
} inline void solve() {
long long ra = calc(a, b);
long long rb = calc(b, c);
long long rc = calc(c, a);
long long res = ((ra * rb) % moder) * rc % moder;
printf(Auto, res);
} int main() {
init();
solve();
return ;
}

Codeforces Round #439 (Div. 2) Problem C (Codeforces 869C) - 组合数学的更多相关文章

  1. Codeforces Round #439 (Div. 2) Problem E (Codeforces 869E) - 暴力 - 随机化 - 二维树状数组 - 差分

    Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around ...

  2. Codeforces Round #439 (Div. 2) Problem B (Codeforces 869B)

    Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense ...

  3. Codeforces Round #439 (Div. 2) Problem A (Codeforces 869A) - 暴力

    Rock... Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-sc ...

  4. Codeforces Round #439 (Div. 2)【A、B、C、E】

    Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...

  5. Codeforces Round #716 (Div. 2), problem: (B) AND 0, Sum Big位运算思维

    & -- 位运算之一,有0则0 原题链接 Problem - 1514B - Codeforces 题目 Example input 2 2 2 100000 20 output 4 2267 ...

  6. Codeforces Round #753 (Div. 3), problem: (D) Blue-Red Permutation

    还是看大佬的题解吧 CFRound#753(Div.3)A-E(后面的今天明天之内补) - 知乎 (zhihu.com) 传送门  Problem - D - Codeforces 题意 n个数字,n ...

  7. Codeforces Round #771 (Div. 2), problem: (B) Odd Swap Sort

    Problem - B - Codeforces 就是给你个序列, 给他整成升序的, 每次操作可以使相邻两个数交换位置, 交换条件是二数之和为奇数 结果只需输出是否可以整成升序的 思路: 需要奇数偶数 ...

  8. Codeforces Round #306 (Div. 2), problem: (B) Preparing Olympiad【dfs或01枚举】

    题意: 给出n个数字,要求在这n个数中选出至少两个数字,使得它们的和在l,r之间,并且最大的与最小的差值要不小于x.n<=15 Problem - 550B - Codeforces 二进制 利 ...

  9. Codeforces Round #754 (Div. 2), problem: (A) A.M. Deviation泪目 万万没想到狂wa是因为这

    Problem - A - Codeforces 题目 题意很简单每次操作可以使得a1 a2  a3任意两个数分别+1  -1 求最后使得a+c-2b绝对值的最小值 BUG就是最后忽略了-2和2这一点 ...

随机推荐

  1. 实验long raw 和 blob两种数据类型遇到dblink的表现

    首先long raw从Oracle 10g开始就不再被建议使用,建议用blob代替.同理,long建议用clob代替. 本文从运维角度实验long raw 和 blob两种数据类型在遇到dblink时 ...

  2. LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏。

    问题描述:VS2010   LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏. 解决办法: 修改嵌入清单选项为否,然后重新便于创建. 参考自:htt ...

  3. Mongodb 文档时间字段修改

    mongo文档[tblEvent]如下: {     "_id" : ObjectId("5a0415f9bf28b684b1c7f5b2"),     &qu ...

  4. efcore从数据库快速生成实体及context

    有些项目开发时先建立数据库,再用codefirst来书写entity和EntityConfiguration,比较耗费功夫. 1.在vs2017中新建个asp.net core的web项目,或者其他项 ...

  5. Vue系列之 => 使用钩子函数的第二个参数传参

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Thinking-Bear magic (计算几何)

    ---- 点我 ---- 题目大意: 给你一个正n边形及边长 a和一个正整数L, 求正多边形的面积s,若s大于L,则连接相邻两边的中点,形成新的正多边形,重复这个操作直至s小于L:如图: 正多边形的面 ...

  7. latex 公式 和排版

    http://bbs.chinatex.org/forum.php?mod=viewthread&tid=7423 http://blog.sina.com.cn/s/blog_5e16f17 ...

  8. oracle查询每隔5分钟区间内的数据量

    SELECT COUNT (DISTINCT tmp.PLATE) totalNum, tmp.newTime FROM ( SELECT T .LICENSE_PLATE plate, TO_CHA ...

  9. 设置Source Insight显示格式

    调整字体大小 默认的忍不了,百度之,解决方案如下:1.Document Options -> Screen Fonts -> 字体设置为新宋体(等宽)或者其他支持中文的字体,字符集选GB2 ...

  10. TCP协议的三次握手

    TCP协议是面向连接的通信协议,即在传输数据前先在发送端和接收端建立逻辑连接,然后再传输数据,它提供了两台计算机之间可靠无差错的数据传输. l  IP地址:用来唯一表示我们自己的电脑的,是一个网络标示 ...