a了96的C++版
#include<algorithm>
#include<iostream>
typedef long long LL;
using namespace std;
LL a[10000];
const LL mod = 1000000007;
int main() {
 int n;
 memset(a, 0, sizeof(a));
 for (int i = 1; i <= 4; i++) {
  cin >> a[i];
 }
 cin >> n;
 for (int i = 5; i <= n; i++) {
  a[i] = a[i-1]  + a[i-3] + a[i-4];
 }
 LL tm = a[n]%mod;
 cout <<tm<< endl;
 return 0;
}