PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000068. Đổi tiền bằng các số lập phương (Ingenuous Cubrency)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đổi tiền bằng các số lập phương (Ingenuous Cubrency)

Ingenuous Cubrency

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Cubeland uses coins of denominations 13,23,…,2131^3,2^3,\ldots,21^3, that is, 1,8,27,…,92611,8,27,\ldots,9261. Every denomination has an unlimited supply.

For a positive integer amount nn, count the number of combinations of coins summing to exactly nn. Two selections are different only when their multiplicities for at least one denomination differ; the order of coins does not matter. Return the exact integer, not a value modulo a constant. For example, amount 2121 can be represented as 2121 ones, one eight and 1313 ones, or two eights and 55 ones, giving three ways.

Input

One line contains the positive integer nn.

Output

Print the exact number of unordered cubic-coin combinations, using a 64-bit integer; do not take a modulus.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100; 21 denominations i3i^3 for 1≤i≤211\le i\le21, unlimited supply.
  • Subtask 2 (30 points): 1≤n≤15001\le n\le 1500; 21 denominations i3i^3 for 1≤i≤211\le i\le21, unlimited supply.
  • Subtask 3 (50 points): 1≤n≤99991\le n\le 9999; 21 denominations i3i^3 for 1≤i≤211\le i\le21, unlimited supply.

Examples

Input

21

Output

3

Explanation

Only 11 and 88 can be used for 2121. Taking zero, one or two 88-coins yields three combinations, with the rest filled by ones.