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. 在haoodp-2.7.3 HA的基础上安装Hbase HA

    前提安装好hadoop基于QJM的高可用 node1 HMaster node2 HMaster.HRegionServer node3 HRegionServer node4 HRegionServ ...

  2. (二)、Python 基础

    Python入门 一.第一句Python 在 /home/dev/ 目录下创建 hello.py 文件,内容如下: print "hello,world" 执行 hello.py ...

  3. PAT (Basic Level) Practice 1006 换个格式输出整数

    个人练习 让我们用字母B来表示“百”.字母S表示“十”,用“12...n”来表示个位数字n(&lt10),换个格式来输出任一个不超过3位的正整数.例如234应该被输出为BBSSS1234,因为 ...

  4. 操作视频-对视频进行canny边缘检测

    #include<opencv2/opencv.hpp> using namespace cv; int main() { VideoCapture capture(); //从摄像头读入 ...

  5. [KMP][BZOJ1355][Baltic2009]Radio Transmission

    题面 Description 给你一个字符串,它是由某个字符串不断自我连接形成的. 但是这个字符串是不确定的,现在只想知道它的最短长度是多少. Input 第一行给出字符串的长度,\(1 < L ...

  6. BAD_ACCESS在什么情况下出现?如何调试BAD_ACCESS错误

    1. 访问一个僵尸对象,访问僵尸对象的成员变量或者向其发消息 死循环 2. 设置全局断点快速定位问题代码所在行 开启僵尸对象调试功能  

  7. 关于在虚拟机上安装iOS所遇到的问题

    先配一张成功的图片: 要想实现上图所示的,就要安装 unlocker206, 安装完unlocker206 不用改里面的内容!!!看到**经验上说还要改内容,结果我试了很多次,根本不行,其实问题不在改 ...

  8. mac安装虚拟机VirtualBox,并在虚拟机上安装centos

    1. 首先从网页上https://www.virtualbox.org/wiki/Downloads下载VirtualBox-6.0.0-127566-OSXdmg文件.我一般把下载的文件放到/opt ...

  9. Python 自学 Day1

    作业二:编写登陆接口 输入用户名密码 认证成功后显示欢迎信息 输错三次后锁定 #!/usr/bin/env python import getpass def log(): uname = input ...

  10. day06_03 购物车讲解01

    1.0 思路 1.1 列表嵌套 # name1 = ['mac','book','bike','kindle'] a = [[1,2,3],'alex',(2,3,4)] print(a[0]) #& ...