zhber 有好多做过的题没写下来，如果我还能记得就补吧

3
1 2 3

## Sample Output

10

f[a1][a2][a3][a4][a5][k]表示能刷1次的油漆还有a1种，刷2次的还有a2种，刷3次的还有a3种，刷4次的还有a4种，刷5次的还有a5种，上一个涂的是还能刷k次的某一种油漆的方案

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
#define mod 1000000007
using namespace std;
{
LL x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
LL f[16][16][16][16][16][6];
bool mrk[16][16][16][16][16][6];
int rep[6];
int n;
inline LL cal(int a1,int a2,int a3,int a4,int a5,int from)
{
if (mrk[a1][a2][a3][a4][a5][from])return f[a1][a2][a3][a4][a5][from];
if (a1+a2+a3+a4+a5==0)return 1;
LL ans=0;
if (a1)ans+=(a1-(from==2))*cal(a1-1,a2,a3,a4,a5,1);
if (a2)ans+=(a2-(from==3))*cal(a1+1,a2-1,a3,a4,a5,2);
if (a3)ans+=(a3-(from==4))*cal(a1,a2+1,a3-1,a4,a5,3);
if (a4)ans+=(a4-(from==5))*cal(a1,a2,a3+1,a4-1,a5,4);
if (a5)ans+=a5*cal(a1,a2,a3,a4+1,a5-1,5);
ans%=mod;
mrk[a1][a2][a3][a4][a5][from]=1;
f[a1][a2][a3][a4][a5][from]=ans;
return f[a1][a2][a3][a4][a5][from];
}
int main()
{