All problems

Problem 965

Count Sorted Vowel Strings

Medium · 20 pts · Math, Dynamic Programming, Combinatorics

Problem

Count the strings of length N made only of the vowels a, e, i, o and u whose letters are in non-decreasing alphabetical order (each letter is the same as or after the one before it), like aaeu or iou. Such a string is fully described by how many times each of the five vowels appears, so the answer is the number of ways to split N into 5 non-negative parts: C(N + 4, 4). The numbers in this problem can be larger than a 32-bit int can hold (about 2.1 × 10^9), so use a 64-bit integer type: long long in C++, long in Java (Python needs nothing special).

Input

A single integer N.

Output

Print the number of sorted vowel strings.

Constraints

1 <= N <= 1000

Example input

2

Example output

15

Explanation

For N = 2 there are 15 strings: aa, ae, ai, ao, au, ee, ei, eo, eu, ii, io, iu, oo, ou and uu. The formula gives C(6, 4) = 15.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Number of Ways to Paint N × 3 Grid Next: Minimum Difficulty of a Job Schedule