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

#SP0000131. Tổng các số nguyên tố liên tiếp (Sum of Consecutive Prime Numbers)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng các số nguyên tố liên tiếp (Sum of Consecutive Prime Numbers)

Sum of Consecutive Prime Numbers

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer n≥2n\ge2, consider the increasing prime sequence 2,3,5,7,11,13,…2,3,5,7,11,13,\ldots. Count representations of nn as the sum of one or more consecutive elements of this prime sequence. A single prime counts as one representation. The chosen primes must be consecutive in the sequence.

Input

One line containing the integer nn.

Output

Print one integer: the number of representations.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1002\le n\le 100.
  • Subtask 2 (30 points): 2≤n≤10002\le n\le 1000.
  • Subtask 3 (50 points): 2≤n≤100002\le n\le 10000.

Examples

Input

41

Output

3

Explanation

For n=41n=41, exactly three consecutive-prime segments sum to 4141: 2+3+5+7+11+13=412+3+5+7+11+13=41, 11+13+17=4111+13+17=41, and the one-element segment 4141. Hence print 3.