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. Java - 基础数据类型的极值

  2. js点击获取标签里面id属性

    <html xmlns="http://www.w3.org/1999/xhtml"> <head > <title></title> ...

  3. scrapy--matplotlib

    昨天晚上看了一些关于保存文件的相关资料,早早的睡了,白天根据网上查找的资料,自己再捡起来.弄了一上午就爬取出来了,开心!!!好吧,让我们开始 老规矩,先上图.大家也赶快行动起来 分类文件: 文件内co ...

  4. HTML5--混合布局

    1.先上效果图,大家来看看 2.代码如下: <!doctype html> <meta charset='utf-8' content='text/html' /> <h ...

  5. tcl之控制流-foreach

  6. iOS常用控件-UIScrollView

    一. 常见属性 @property (nonatomic) CGPoint contentOffset;                      //记录UIScrollView滚动的位置 @pro ...

  7. A Country on Wheels【车轮上的国家】

    A Country on Wheels As cultural symbols go, the American  car is quite young. 作为文化象征的美国汽车还相当年轻. The ...

  8. Dapper.Extension的基本使用

    前言    上一篇随笔写了Dapper的简单的使用,这次写一下Dapper.Extension的使用,它是Dapper的简单的封装扩展,可以通过实例化的对象赋值后进行增删改的操作以及分页,但是却不能进 ...

  9. ElasticSearch学习笔记(五)-- 排序、分页与遍历

    1. 相关性算分 这样能够查询到不同分片上的文档的准确算分,默认分片为5 2. sorting-doc-values-fielddata 3. 分页与遍历

  10. css3 3D

    开通黄钻 Css3 -3D效果<!DOCTYPE html><html lang="en"><head> <meta charset=&q ...