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. linux安装openldap步骤

    目录 虚拟机环境:centos 7 一.环境准备 1.关闭 selinux firewalld 临时: setenforce 0  永久: vi /etc/sysconfig/selinux SELI ...

  2. Angular环境配置

    1.安装node.js 访问官方网站:https://nodejs.org/en/下载node.js,直接下一步安装即可.安装完成打开cmd命令窗口输入node -v出现node版本号安装成功. 2. ...

  3. PHP 输出控制

    一.前言 说到PHP输出控制, 在很多框架里面,比如说TP,Yii和Laraval的模版引擎里面都有输出控制函数的阴影,输出控制也叫输出缓冲,说到它的作用有以下几点. 二.内容 1. 输出模版 $va ...

  4. 2,版本控制git --分支

    有人把 Git 的分支模型称为它的`‘必杀技特性’',也正因为这一特性,使得 Git 从众多版本控制系统中脱颖而出. 为何 Git 的分支模型如此出众呢? Git 处理分支的方式可谓是难以置信的轻量, ...

  5. TP5 中出现 No input file specified

    之前用php5.4 更新至php7之后原tp5项目出现 No input file specified 修改方法: 打开public目录下的.htaccess文件,把:RewriteRule ^(.* ...

  6. 读json文件发生错误,所遇到的坑

    当我们生产者生产json 文件的时候   消费时用JSON读文件时,如下: val values = kafkardd.map(t=>JSON.parseObject(t._2)) 如果发生以下 ...

  7. BInder浅析

    Binder是什么 Binder是运行在Android内核态用于进程间通信(IPC)的驱动,采用C/S架构,由三项基本组件组成:Binder服务端,Binder驱动,应用程序客户端. 为什么要用Bin ...

  8. selenium初识(二)——之webdriver API

    配置完的环境之后,我们先来写一个小脚本: # __Author__:"Jim_xie" from selenium import webdriver from time impor ...

  9. Canvas 图片绕边旋转的小动画

    /** * 图片绕边旋转的小动画 */ function initDemo10() { var canvas = document.getElementById("demo10") ...

  10. NGUI执行基本事件的原理

    通常我们为对象附加一个脚本组件,脚本组件只要加此鼠标处理事件方法,这个对象就有了点击事件了: void OnClick() { Debug.Log("onclick"); } 可为 ...