This page is still under construction.

Parts of this page are still being built. What you see may change.

Heeju's Math Exam

Time limit1sMemory limit128 MB

Summary
Sum the terms from position A to B in the sequence where each integer k appears k times in a row.
Level

Easy2 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

An integer sequence is built by the following rule: 1 appears once, 2 appears twice, 3 appears three times, …, that is, the integer kk appears kk times in a row. So the sequence begins like this.

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, …1,\ 2,\ 2,\ 3,\ 3,\ 3,\ 4,\ 4,\ 4,\ 4,\ 5,\ \dots

Given two integers AA and BB, compute and print the sum of all values from the AA-th term to the BB-th term of this sequence, inclusive.

Input

A single line contains two integers AA and BB separated by a space. (1≤A≤B≤10001 \le A \le B \le 1000)

Output

Print, on one line, the sum of the terms from the AA-th to the BB-th.

Examples3

  1. Example 1

    Input
    1 3
    
    Expected output
    5
    
  2. Example 2

    Input
    3 7
    
    Expected output
    15
    
  3. Example 3

    Input
    50 50
    
    Expected output
    10