Problem:
Problem I. Sum of QQ

You received a card with an integer $S$ and a multiplication table of infinite size. All the elements in the table are integers, and an integer at the $i$-th row from the top and the $j$-th column from the left is $A_{i,j} = i \times j$ ($i,j \geq 1$). The table has infinite size, i.e., the number of the rows and the number of the columns are infinite.

You love rectangular regions of the table in which the sum of numbers is $S$. Your task is to count the number of integer tuples $(a, b, c, d)$ that satisfies $1 \leq a \leq b, 1 \leq c \leq d$ and $\sum_{i=a}^b \sum_{j=c}^d A_{i,j} = S$.

Input

The input consists of a single test case of the following form.

$S$

The first line consists of one integer $S$ ($1 \leq S \leq 10^5$), representing the summation of rectangular regions you have to find.

Output

Print the number of rectangular regions whose summation is $S$ in one line.

Examples

Sample Input 1

25

Output for Sample Input 1

10

Sample Input 2

1

Output for Sample Input 2

1

Sample Input 3

5

Output for Sample Input 3

4

Sample Input 4

83160

Output for Sample Input 4

5120

Solution in Rust (judge verdict: Accepted)

extern crate core;

use std::str::FromStr;
use std::fmt;
use std::cmp::{Ordering, max};
use std::fmt::{Display, Error, Formatter};
use std::ops::{Range, Add};

struct InputStream {
    line: Vec<String>,
    position: usize
}
type Parse<T: FromStr> = Result<T, T::Err>;
impl InputStream {
    fn new() -> InputStream {
        InputStream {line:vec![], position: 0}
    }
    fn read_word(&mut self) -> &String {
        if self.position == self.line.len() {
            let mut line= String::new();
            std::io::stdin().read_line(&mut line).ok();
            self.line = line.split_whitespace().map(|x|x.to_string()).collect();
            self.position = 0
        }
        let result = &self.line[self.position];
        self.position += 1;
        result
    }
    fn read<T: FromStr>(&mut self) -> Parse<T> {
        self.read_word().parse()
    }
    fn get<T: FromStr>(&mut self) -> T {self.read().ok().unwrap()}
    fn read_int(&mut self) -> i32 {self.get()}
    fn read_long(&mut self) -> i64 {self.get()}
    fn read_double(&mut self) -> f64 {self.get()}
    fn read_usize(&mut self) -> usize {self.get()}
}
macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}

macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
macro_rules! repeat {
    ($count:expr; $($statement:tt)+) => {
        for _ in 0 .. $count {
            $($statement)*
        }
    };
}

macro_rules! yields {
    ($count:expr; $block:block) => {{
        let mut vec = Vec::with_capacity($count);
        for _ in 0 .. $count {
            vec.push($block);
        }
        vec
    }}
}
macro_rules! array {
    ($factor: expr; ) => {$factor};
    ($factor: expr; $dimension: expr) => {{
        let size = $dimension;
        let mut vec = Vec::with_capacity(size);
        for _ in 0 .. size {
            vec.push($factor)
        }
        vec
    }};
    ($factor:expr; $dimension:expr, $($r:expr),*) => {{
        let size = $dimension;
        let mut vec = Vec::with_capacity(size);
        for _ in 0 .. size{
            let factor = array!($factor; $($r),*);
            vec.push(factor)
        }
        vec
    }};
}
fn tabulate<F, R>(count: usize, mut generator: F) -> Vec<R> where F : FnMut(usize) -> R {
    let mut result = Vec::<R>::with_capacity(count);
    for f in 0..count {
        result.push(generator(f));
    }
    result
}
fn binary_search(vec: &Vec<i64>, target: i64) -> bool {
    let mut left = 0;
    let mut right = vec.len();
    while left < right {
        let mid = (left + right) / 2;
        if vec[mid] == target {
            return true
        }
        if vec[mid] < target {
            left = mid + 1;
        }else {
            right = mid;
        }
    }
    return false
}
fn main() {
    let_all!(s: usize);
    let sum = tabulate(s + 1, |x|{(x as i64) * (x as i64 + 1) / 2});
    let divisors: Vec<usize> = (2 as usize..s + 1).filter(|x|s % x == 0).collect();
    let mut count = vec![0; s + 1];
    count[1] = 1;
    for &n in &sum {
        for &d in &divisors {
            if n >= d as i64 && binary_search(&sum, n - d as i64) {
                count[d] += 1;
            }
        }
    }
    let mut result = count[1] * count[s];
    for d in divisors{
        result += count[d] * count[s / d]
    }
    println!("{}", result)
}