time limit per test 1 second

memory limit per test 256 megabytes

input standard input

output standard output

— 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 a, b 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 a, b 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 is23 = 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.

【翻译】给出三种颜色的点的数目a,b,c,现在连边建图,要求:同种颜色点之间距离大于等于3(无法通达也可以),求构图方案数。

题解:

      ①关键结论是两个颜色点的连边和另一种颜色无关。

      ②直接对两种颜色dp:

           设f[i][j]表示有i个1号颜色的点,j个2号颜色的点的构图方案数。

           转移来源表示新加入的2颜色的点是否连边:
           f[i][j]=f[i][j-1]+f[i-1][j-1]*i

      ③最终答案:f[a][b]*f[a][c]*f[b][c]

#define M 998244353
#define ll long long
#include<bits/stdc++.h>
#define go(i,a,b) for(int i=a;i<=b;i++)
const int N=5003;
ll f[N][N];
int a,b,c,n;
int main()
{
scanf("%d%d%d",&a,&b,&c);
n=std::max(a,std::max(b,c));
go(i,1,n)f[i][0]=f[0][i]=1;f[0][0]=1;
go(i,1,n)go(j,1,n)f[i][j]=(f[i][j-1]+f[i-1][j-1]*i)%M;
printf("%d",((f[a][b]*f[b][c])%M*f[a][c])%M);return 0;
}//Paul_Guderian

寻找生命的意义真的并不容易,

那是件辛酸而伟大的事情。——————汪峰《改变》

【CF Round 439 C. The Intriguing Obsession】的更多相关文章

  1. 【CF Round 439 E. The Untended Antiquity】

    time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standa ...

  2. 【CF Round 439 B. The Eternal Immortality】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  3. 【CF Round 439 A. The Artful Expedient】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  4. Codeforces Round #439 C. The Intriguing Obsession

    题意:给你三种不同颜色的点,每种若干(小于5000),在这些点中连线,要求同色的点的最短路大于等于3或者不连通,求有多少种连法. Examples Input 1 1 1 Output 8 Input ...

  5. code forces 439 C. The Intriguing Obsession

    C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...

  6. 【Codeforces Round #439 (Div. 2) C】The Intriguing Obsession

    [链接] 链接 [题意] 给你3种颜色的点. 每种颜色分别a,b,c个. 现在让你在这些点之间加边. 使得,同种颜色的点之间,要么不连通,要么连通,且最短路至少为3 边是无向边. 让你输出方案数 [题 ...

  7. 【codeforces】【比赛题解】#869 CF Round #439 (Div.2)

    良心赛,虽然我迟了半小时233333. 比赛链接:#869. 呃,CF的比赛都是有背景的……上次是<哈利波特>,这次是<物语>…… [A]巧妙的替换 题意: Karen发现了石 ...

  8. 【CF Round 434 B. Which floor?】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  9. 【CF Round 434 A. k-rounding】

    Time limit per test1 second memory limit per test 256 megabytes input standard input output standard ...

随机推荐

  1. 经典sql语句汇总

    1,某条数据放首位,其他倒序并分页 select * from Student order by( case     when id='2'  then 1 ELSE 4 END),id desc l ...

  2. CodeMirror的使用方法

    最近项目中用到了CodeMirror这个代码编辑器,感觉非常好用,可以设置很多种代码格式.默认前提是你已经正确引入了所有的js文件和css文件. 下面是我在项目中用到过和在网上搜集整理的使用方法: 1 ...

  3. (三)Swagger配置多项目共用

    重构了多个项目后,在联调接口时,查看api会发现Swagger在几个项目可用,有几个不可用,配置都一样,扫描也充分,那问题出在哪里呢?先仔细找了下Docket的源码,发现有这么个方法: /** * P ...

  4. php扩展开发-全局变量

    //php_myext.hZEND_BEGIN_MODULE_GLOBALS(myext) unsigned long counter;//在这里定义需要的全局变量,可以多个,每个变量一行, ZEND ...

  5. SQL-批量插入和批量更新

    批量插入 表结构一样或类似 如果两张表的结构一样,例如一个表的结构和另一个表的结构一样,只是其中一张是临时表,而另一张表是存储数据的表,我们需要进行一次表的迁移的话,我们可以这样. insert in ...

  6. qt5.10.1编译记录

    qt版本更新比较快,不知道选哪个版本合适,故选择一个较新版本的. 平台imx6    +    linux4.1.16   +   qt5.10.1 采用明远智睿提供的编译器:fsl-imx-fb-g ...

  7. [Codeforces958F2]Lightsabers (medium)(思维)

    Description 题目链接 Solution 设一个l指针指向当前数列左边,从左往右扫描一遍,将当前颜色记录, 当所有颜色都得到后,进行判断,如果当前l指向的颜色大于需要的颜色,l后移一位,然后 ...

  8. 树上dfs+思维

    #include<cstdio> ; int cnt,head[N],n; int size[N],num[N]; void init() { cnt = ; ;i<N;i++) h ...

  9. Spring.net Ioc 依赖注入

    控制反转 (Inversion of Control,英文缩写为IoC)是一个重要的面向对象编程的法则来削减计算机程序的耦合问题,也是轻量级的Spring框架的核心. 控制反转一般分为两种类型,依赖注 ...

  10. HttpMessageConverter进行加密解密

    技术交流群: 233513714 使用自定义HttpMessageConverter对返回内容进行加密 今天上午技术群里的一个人问” 如何在 Spring MVC 中统一对返回的 Json 进行加密? ...