jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]
package com.codeCp;

import java.util.*;
import java.io.*;

public class Main {
    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int x = sc.nextInt(), y = sc.nextInt(), z = sc.nextInt(), z1 = sc.nextInt();
        if (x + y > z + z1) {
            System.out.println("Left");
        } else if (x + y == z + z1) {
            System.out.println("Balanced");
        } else {
            System.out.println("Right");
        }
    }
}
//  [java]
import java.util.*;
import java.io.*;
import java.lang.*;

public class ABC083A {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int a = sc.nextInt();
		a+=sc.nextInt();
		int b = sc.nextInt();
		b+=sc.nextInt();
		sc.close();

		if (a != b) {
			System.out.println(a>b ? "Left" : "Right");
		} else {
			System.out.println("Balanced");
		}
	}
}
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int a = sc.nextInt();
		a+=sc.nextInt();
		int b = sc.nextInt();
		b+=sc.nextInt();
		sc.close();

		if (a != b) {
			System.out.println(a>b ? "Left" : "Right");
		} else {
			System.out.println("Balanced");
		}
	}
}
//  [cpp]
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int t,n,m;
int a,b,c,d;
int main(){
	int i,j;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a+b>c+d)
		printf("Left\n");
	else if(a+b==c+d)
		printf("Balanced\n");
	else
		printf("Right\n");
	return 0;
}
//  [cpp]
#include <stdio.h>
int main (){
int a ,b,c,d;
scanf ("%d%d%d%d",&a,&b,&c,&d);

if (a+ b > c +d )
    printf("Left\n");

else
   if (a+ b < c +d )
    printf("Right\n");

else if (a+ b == c +d )
    printf("Balanced\n");

return 0;
}
//  [cpp]
#include<stdio.h>
#include<math.h>
int main()
{
	int A,B,C,D,x,y;
	while(scanf("%d%d%d%d",&A,&B,&C,&D)!=EOF)
	{
		x=A+B;y=C+D;
		if(x==y)
		{
			printf("Balanced\n");
		}
		else{
			if(x>y)
			{
				printf("Left\n");
			}
			else{
				printf("Right\n");
			}
		}
	}
	return 0;
 }
//  [cpp]
#include<bits/stdc++.h>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
 
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << (a + b == c + d ? "Balance" : a + b > c + d ? "Left" : "Right") << endl;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

int main() {

  int A, B,C,D;

  cin>> A >> B >>C>>D ;

int left =A+B;
int right=C+D;
  
if (lert>right) {

cout << "Left" << endl;

  }

  

  else if(left<right){

    // ここにプログラムを追記

    cout<<"Right"<<endl;
  }

  else if(left==right){
    cout<<"Balanced"<<endl;
    }

 

  }
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a,b;
cin >> A  >>B >> C>> D;

 if (A+B<C+D){
 cout << "Left";
 } 
  if else(A+B>C+D){
 cout << "Right";
 }
  else{
  cout << "Balanced"
  }
 
}
//  [c]
#include <stdio.h>

int main()
{   
	int a,b,c,d;
	int left = 0,right = 0;
	 
	scanf(" %d %d %d %d",&a,&b,&c,&d);
	left = a + b;
	right = c + d;
	if(left<right){
	printf("Right");
	}
	if(right<left){
		printf("Left");
	}
	if(left == right){
	printf("Balanced");
	}
	return 0;
}
//  [c]
#include <stdio.h>

int main(void) {

	int a = 0, b = 0, c = 0, d = 0;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	if ((a + b) < (c + d)) {
		printf("Right\n");
	}
	else if ((a + b) > (c + d)) {
		printf("Left\n");
	}
	else
		printf("Balanced\n");

	return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int a, b, c, d;
    int sum1=0, sum2=0;

    scanf("%d", &a);
    scanf("%d", &b);
    sum1 = a + b;
    
    scanf("%d", &c);
    scanf("%d", &d);
    sum2 = c + d;

    if(sum1 > sum2){
        printf("Left\n");
    }else if(sum2 > sum1){
        printf("Right\n");
    }else{
        printf("Balanced\n");
    }

    return 0;
}
//  [c]
#include <stdio.h>

int main() 
{
	int A,B,C,D;
	
	scanf("%d %d %d %d",&A,&B,&C,&D);
	
	if (A+B>C+D)
	{
	printf("Left");
	    
	}
	if else (A+B<C+D)
	{
	printf("Right");
	    
	}
	if else(A+B==C+D)
	{
	printf("Balanced");
	    
	}
	
	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int A,B,C,D;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    if(A+B>C+D) {
        printf("Left");
    }
    else if(A+B=C+D) {
        printf("Balanced");
    }
    else {
        printf("Right");
    }
    return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int A,B,C,D;
    scanf("%d%d%d%d",&A,&B,&C,&D);
    if(A+B>C+D) {
        printf("Left\n");
    }
    else if(A+B=C+D) {
        printf("Balanced\n");
    }
    else {
    printf("Right\n");
    }
    return 0;
}
//  [javascript]
function main(input) {
    var a = input[0].split(" ")[0]-0;
    var b = input[0].split(" ")[1]-0;
    var c = input[0].split(" ")[2]-0;
    var d = input[0].split(" ")[3]-0;
  var l = a+b;
  var r = c+d;
  
    console.log(l==r?"Balanced":(l>r?"Left":"Right"));
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8").split(/\s/);
const a = input[0] - 0;
const b = input[1] - 0;
const c = input[2] - 0;
const d = input[3] - 0;

if (a + b < c + d) {
  console.log("Right");
} else if (a + b > c + d) {
  console.log("Left");
} else {
  console.log("Balanced");
}
//  [javascript]
'use strict'

function main(input) {

    input = input.split(/\n|\s/).map(v => ~~v)
    const sum = input[0] + input[1] - (input[2] + input[3])

    let ans = 'Balanced'

    if (sum > 0) {
        ans = 'Left'
    } else if (sum < 0) {
        ans = 'Right'
    }
    console.log(ans)

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    const args = input.split(' ');
    const N = parseInt(args[0], 10),
          A = parseInt(args[1], 10),
          B = parseInt(args[2], 10);

    const nums = Array.from(new Array(N), (v, i) => ++i).filter((i) => {
        var n = i.toString().split('').reduce((p, c) => p + parseInt(c), 0);
        return (n >= A && n <= B);
    });

    console.log(nums.reduce((p, c) => p + c, 0));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input){
	input = input.split(" ");
  	if(input[0] + input[1] > input[2] + input[3]) {
    	console.log('Left')
    } else if(input[0] + input[1] < input[2] + input[3]) {
      	console.log('Right')
    } else {
      	console.log('Balanced')
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
const inputText = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .trim()
  .split("")
  .map((i) => parseInt(i, 10));

const left = inputText[0] + inputText[1];
const right = inputText[2] + inputText[3];

if (left < right) {
  console.log("Right");
} else if (left > right) {
  console.log("Left");
} else {
  console.log("Balanced");
}
//  [go]
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	if l, r := a+b, c+d; l > r {
		fmt.Println("Left")
	} else if l < r {
		fmt.Println("Right")
	} else {
		fmt.Println("Balanced")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	bs := NewBufScanner(in)
	bw := NewBufWriter(out)
	defer bw.w.Flush()

	left := bs.IntScan() + bs.IntScan()
	right := bs.IntScan() + bs.IntScan()
	if left == right {
		bw.Printf("Balanced")
	} else if left > right {
		bw.Printf("Left")
	} else {
		bw.Printf("Right")
	}
}

// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// IntScan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}
//  [go]
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	if a+b > c+d {
		fmt.Println("Left")
	} else if a+b < c+d {
		fmt.Println("Right")
	} else {
		fmt.Println("Balanced")
	}
}
//  [go]
package main
 
import (
	"fmt"
)
 
func main() {
	var a, b, c, d int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	left := a + b
	right := c + d
	if left == right {
		fmt.Printf("%s", "Balanced")
	} else if left < right {
		fmt.Printf("%s", "Left")
	} else {
		fmt.Printf("%s", "Right")
	}
}
//  [go]
package main
 
import (
	"fmt"
)
 
func main() {
	var a, b, c, d int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	left := a + b
	right := c + d
	if left == right {
		fmt.Printf("%s", "Balanced")
	} else if left > right {
		fmt.Printf("%s", "Left")
	} else {
		fmt.Printf("%s", "Right")
	}
}
//  [go]
package main

import "fmt"

func findSumOfDigits(n int) int{
	sum := 0
	for n > 0 {
		sum += n % 10
		n /= 10
	}
	return sum
}

func main() {
	var (
		n, a, b, total int
	)
	fmt.Scan(&n, &a, &b)
	for i := 1; i <= n; i++ {
		sum := findSumOfDigits(i)
		if a <= sum && sum <= b {
			total += sum
		}
	}
	fmt.Println(total)
}
//  [ruby]
a,b,c,d = gets.chomp.split(' ').map(&:to_i)
l = a+b
r = c+d
if (l > r)
  puts 'Left'
elsif(l == r)
  puts 'Balanced'
else
  puts 'Right'
end
//  [ruby]
#!/usr/bin/env ruby

def main
    a,b,c,d = gets.chomp.split(" ").map(&:to_i)
    if (a+b) > (c+d)
        puts "Left"
    elsif (a+b) == (c+d)
        puts "Balanced"
    else
        puts "Right"
    end
end

main
//  [ruby]
# abc083 A
a, b, c, d = gets.split.map(&:to_i)
puts a + b == c + d ? 'Balanced' : a + b > c + d ? 'Left' : 'Right'
//  [ruby]
n, a, b = gets.strip.split.map(&:to_i)

# 各桁の和を求める
def digit_sum n
    sum = 0
    while n > 0 do
        sum += n % 10
        n /= 10
    end
    sum
end

ans = (1..n)
        .map { |i| [i, digit_sum(i)] }
        .select { |d| a <= d[1] && d[1] <= b }
        .inject(0) { |sum, d| sum + d[0] }

puts ans
//  [ruby]
a,b,c,d = gets.strip.split.map(&:to_i)
if a+b>c+d
  puts "Left"
elsif a+b=c+d
  puts "Balanced"
else
  puts "Right"
end
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	let c = v[2];
	let d = v[3];
	if a+b > c+d {
		println!("Left");
	}else if a+b < c+d {
		println!("Right");
	}else{
		println!("Balanced");
	}
}
//  [rust]
use std::cmp::Ordering;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let  s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i32, b: i32, c: i32, d: i32
    }
    println!("{}",
    match (a+b).cmp(&(c+d)) {
        Ordering::Greater => "Left",
        Ordering::Equal => "Balanced",
        Ordering::Less => "Right"
    });
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let d: usize = read();

    if a + b > c + d {
        println!("Left");
        return;
    }
    if a + b < c + d {
        println!("Right");
        return;
    }

    println!("Balanced")
}
//  [rust]
use std::io::{stdin, Stdin, BufRead};

fn main() {
    let stdin = stdin();
    let args = read(&stdin);
    let args = args.split_whitespace();
    let args = args.into_iter().map(|s| s.parse().unwrap()).collect::<Vec<i32>>();
    let n = args[0];
    let a = args[1];
    let b = args[2];

    let mut numbers = Vec::new();
    for i in a..n+1 {
        let mut sum = 0;
        let mut res = i;
        loop {
            let modulo = res % 10;
            sum += modulo;

            res = (res / 10) as i32;
            if res <= 10 {
                sum += res;
                break;
            }
        }

        if a <= sum && sum <= b {
            numbers.push(i);
        }

    }
    println!("{}", numbers.iter().sum::<i32>());
}

fn read(stdin: &Stdin) -> String {
    let mut buf = String::new();
    stdin.lock().read_line(&mut buf).unwrap();
    buf
}
//  [rust]
fn mainfn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v : Vec<i32> = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
    let x = v[0] + v[1];
    let y = v[2] + v[3];
    if x > y {
        println!("Left");
    }
    else if x == y {
        println!("Balanced");
    }
    else {
        println!("Right");
    }
}
//  [swift]
var i=readLine()!.characters.split(" ").map{Int(String($0))!},s="Balanced";if i[0]+i[1]>i[2]+i[3]{s="Left"};if i[0]+i[1]<i[2]+i[3]{s="Right"};print(s)
//  [swift]
import Glibc
extension String: CollectionType {}

var inp = readLine()!.split(" ").map { Int($0)! }
if inp[0] + inp[1] < inp[2] + inp[3] {
  print("Right")
} else if inp[0] + inp[1] > inp[2] + inp[3] {
  print("Left")
} else {
  print("Balanced")
}
//  [swift]
import Foundation

if let str = readLine() {
    let arr = str.split(separator: " ").map { Int($0)!}
    switch arr[0] + arr[1] - arr[3] - arr[4] {
    case 0:
        print("Balanced")
    case 1...:
        print("Left")
    default:
        print("right")
    }
}
//  [swift]
import Foundation

var line: String

line = readLine()!

var nums: [Int] = Array<Int>()
for num in line.components(separatedBy:" ") {
	nums.append(Int(num)!)
}

if nums[0] + nums[1] < nums[2] + nums[3] {
	print("Right")
}else if nums[0] + nums[1] > nums[2] + nums[3] {
	print("Left")
}else{
	print("Balanced")
}
//  [swift]
var line: String

line = readLine()!

var nums: [Int] = Array<Int>()
for num in line.components(separatedBy:" ") {
	nums.append(Int(num)!)
}

if nums[0] + nums[1] < nums[2] + nums[3] {
	print("Right")
}else if nums[0] + nums[1] > nums[2] + nums[3] {
	print("Left")
}else{
	print("Balanced")
}
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  const C = parseInt(input[2], 10);
  const D = parseInt(input[3], 10);
  
  if (A+B>C+D) {
    console.log("Left");
  }else if(A+B==C+D) {
    console.log("Balanced"); 
  }else{
    console.log("Right");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [a, b, c, d] = stdin.split('\n')[0].split(' ').map(Number)

const res = x => {
  const l = a + b
  const r = c + d

  if(l === r){
    return 'Balanced'
  } else if ( l < r){
    return 'Right'
  } else {
    return 'Left'
  }
}

console.log(res())
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b,c,d]=nrin(4)
  out(a+b==c+d?'Balanced':a+b>c+d?'Left':'Right')
}
main()
//  [typescript]
const lines = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line) {
  lines.push(line);
});

reader.on("close", function () {
  const input = (lines[0] as string).split(" ");
  const maximum = input[0];
  const min = Number(input[1]);
  const max = Number(input[2]);

  console.log(sum(maximum, min, max));
});

function sum(maximum: string, min: number, max: number): number {
  let sum = 0;

  for (let i = 1; i <= Number(maximum); i++) {
    const iSum = digitSum(i);
    if (iSum >= min && iSum <= max) {
      sum = sum + i;
    }
  }

  return sum;
}

function digitSum(number): number {
  const numberArray: number[] = [];
  for (let i = 0; i < String(number).length; i++) {
    numberArray.push(+String(number).charAt(i));
  }
  return numberArray.reduce((accumulator, element) => {
    return accumulator + Number(element);
  });
}
//  [typescript]
s=require('fs').readFileSync('/dev/stdin','utf8').split(' ').map(n=>n|0)
for(c=0,i=0;++i<=s[0];s[1]<=a&&a<=s[2]&&(c+=i))
	a=(i+'').split('').map(n=>n|0).reduce((a,b)=>a+b)
console.log(c)
//  [python]
N,L = map(int,input().split())
inf = float('inf')
eat = inf
ans = 0
for i in range(N):
    eat = min(eat, abs(L+i))
if L > 0:
    s = eat - L + 1
else:
    s = abs(eat + L -1)

for i in range(1,N+1):
    if s == i:
        continue
    ans += L + i -1
print(ans)
//  [python]
N, L = map(int, input().split())
a = [L + i for i in range(N)]
b = list(map(lambda x:abs(x), a))
c = b.index(min(b))
del a[c]
print(sum(j for j in a))
//  [python]
N, L = map(int, input().split())

res = []
for i in range(N):
    res.append(L + (i + 1) - 1)

m = res[0]
for r in res:
    if abs(r) < abs(m):
        m = r
res.remove(m)

print(sum(res))
//  [python]
a,b=map(int,input().split())
if b>=0:
  print(int((a+2*b)*(a-1)/2))
elif a+b>=0:
  print(int((a+2*b-1)*a/2))
else:
  print(int((a+2*b-2)*(a-1)/2))
//  [python]
a,b=map(int,input().split())
if b>=0:
  print(int((a+2*b)*(a-1)/2))
elif a+b>=0:
  print(int((a+b-2)*a/2))
else:
  print(int((a+2*b-2)*(a-1)/2))
//  [python]
n,l = map(int,input().split())
ans = l 
k = 0
sum = 0
for i in range(1,n):
    if abs(ans) > abs(l + i):
        k = i
for i in range(n):
    if i != k:
        sum += l + i
print(sum)
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    int ans = 0;
    int min = Integer.MAX_VALUE;
    for(int i=1; i<=n; i++) {
      ans += l+i-1;
      if(Math.abs(l+i-1)<Math.abs(min)) {
        min = l+i-1;
      }
    }
    System.out.println(ans-min);
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        int l = Integer.parseInt(in[1]);

        int[] taste = new int[n];
        int sum = 0;
        int min = 1000000000;
        int ans = -1;
        for(int i = 0; i < n; i++) {
            taste[i] = l + i;
            sum += taste[i];
        }

        for(int i = 0; i < n; i++) {
            int tmp = Math.abs(taste[i]);
            if(tmp < min) {
                min = tmp;
                ans = i;
            }
        }

        System.out.println(sum - taste[ans]);
    }
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int l = scn.nextInt();
		int[] a = new int[n+1];
      	a[0] = 0;
		for(int i=1; i<=n; i++){
			a[i] = l + i -1;
		}
      	int sum = 0;
      	for(int i=1; i<=n; i++){
          sum += a[i];
        }
      	int low = Math.abs(a[1]);
      	int num = 0;
      	int eat = 0;
      	for(int i=1; i<=n; i++){
          num = Math.abs(a[i]);
          if(low>num){
            low = num;
            eat = a[i];
          }
        }
      	System.out.println(sum-eat);
	}
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int l = scn.nextInt();
		int[] a = new int[n+1];
      	a[0] = 0;
		for(int i=1; i<=n; i++){
			a[i] = l + i -1;
		}
      	int sum = 0;
      	for(int i=1; i<=n; i++){
          sum += a[i];
        }
      	int low = Math.abs(a[1]);
      	int num = 0;
      	int eat = 0;
      	for(int i=1; i<=n; i++){
          num = Math.abs(a[i]);
          if(low>num){
            low = num;
            eat = a[i]
          }
        }
      	System.out.println(sum-eat);
	}
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	int l = scn.nextInt();
		int[] a = new int[n+1];
      	a[0] = 0;
		for(int i=1; i<=n; i++){
			a[i] = l + i -1;
		}
      	int sum = 0;
      	for(int i=1; i<=n; i++){
          sum += a[i];
        }
      	int low = Math.abs(a[1]);
      	int num = 0;
      	for(int i=1; i<=n; i++){
          num = Math.abs(a[i]);
          if(low>num) low = num;
        }
      	System.out.println(sum-low);
	}
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, L;
  scanf("%d %d", &N, &L);

  // solve
  int closest_to_zero = L, total = 0;
  for (int i = 0; i < N; i++) {
    const int k = L + i;
    total += k;
    if (abs(k) < abs(closest_to_zero)) {
      closest_to_zero = k;
    }
  }
  printf("%d\n", total - closest_to_zero);
  
  return 0;
}
//  [cpp]
#include<cstdio>
#include<cmath>
using namespace std;
int a[200];
int main()
{
	int n,l;int sum=0;
	int check=9999,ans;
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)
	{
		a[i]=l+i-1;
	//	printf("%d\n",a[i]);
		if(a[i]==0) check=1;
		sum+=a[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(abs(a[i])<=check) check=abs(a[i]),ans=a[i];
	} 
	printf("%d",sum-ans);
	return 0;
}
//  [cpp]
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int n,l,z,t,y;
	scanf("%d %d",&n,&l);
	t=(n)*(l-1)+n*(n+1)*0.5;
	if(l>0) printf("%d\n",t-l);
	else
	{
		z=10000;
		for(int i=0;i<n;i++)
		{
			y=l+i;
			if(abs(y)<abs(z))
			z=y;
		}
		printf("%d\n",t-z);
	}
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1e9;
const int mod = 1000000007;

int main(){
  int N,L;
  cin>>N>>L;
  int MIN=INF,sum=0;
  int x=0;
  for(int i=1;i<=N;i++){
    sum+=L+i-1;
    if(MIN>abs(L+i-1)){x=L+i-1;}
  }
  cout<<sum-x<<endl;
  return 0;                       
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 100100100;

int main(){
  int n,l;
  cin >> n >> l;

  int tot = (l-1)*n+n*(n+1)/2;
  int cnt = 1;

  int mn = inf;
  for(int i = 1; i <=n; i++){
    if(mn >= abs(l+i-1))){
      mn = abs(l+i-1);
      cnt = i;
    }
  }
  cout << tot - (l+cnt-1) << endl;
    
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 100100100;

int main(){
  int n,l;
  cin >> n >> l;

  int tot = (l-1)*n+n*(n+1)/2;
  int cnt = 1;

  int mn = inf;
  for(int i = 1; i <=n; i++){
    if(mn >= abs(tot+(l+i-1))){
      mn = abs(tot+(l+i-1));
      cnt = i;
    }
  }
  cout << tot - (l+cnt-1) << endl;
    
}
//  [c]
#include <stdio.h>

int main(void)
{
        int n,l,s,i;

        scanf("%d%d",&n,&l);

        int d[n],e[n];

        for(i=0;i<n;i++){
                d[i]=l+i;
        }

        s=0;
        for(i=0;i<n;i++)
                s+=d[i];
        if(l+n-1>0){
               if(l<=0) printf("%d\n",s);
               else printf("%d\n",s-d[0]);
        }
        else printf("%d\n",s-d[n-1]);
        return 0;
}
//  [c]
#include<stdio.h>


int main(void)
{
  int n;
  int l;
  int a;
  
  scanf("%d %d",&n,&l);
  
  if(l>=0)
    a=l;
  else
  {
    if(n+l-1>=0)
      a=0;
    else
      a=n+l-1;
  }
  printf("%d",n*l+n*(n-1)/2-a);
  
  return 0;
  
}
//  [c]
#include <stdio.h>

int main(void) {
  int N,L;

  scanf("%d",&N); scanf("%d",&L);

 if(L>=0)
  printf("%d",(N-1)*(2*L+N)/2);
else if(L+N>=2)
  printf("%d",N*(2*L+N-1)/2);
else
  printf("%d",(N-1)*(2*L+N-2)/2);
  return 0;
}
//  [c]
#include <stdio.h>

int main(){
  int N,L,S=0;
  scanf("%d %d",&N,&L);
  S=N*L+(N*(N-1))/2;
  if(L>=0) S-=L;
  else if(N<-L) S-=L+(N-1);
  printf("%d\n",S);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int n, l, i, sum = 0;
	int min;
	scanf("%d %d", &n, &l);

	//味の合計値と、おいしさの絶対値が最小になるときの値を求める
	min = l;
	for (i = 1; i <= n; i++) {
		sum += l + i - 1;//味の合計

		if (min >= abs(l + i - 1)) {//おいしさの絶対値が最小になるときの値を求める
			min = abs(l + i - 1);
		}
	}

	printf("%d\n", sum - min);

	return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
  //N,Lを入力
  int N,L;
  scanf("%d%d",&N,&L);

  //りんごの味を配列にする
  int i,app[N];
  for(i=0;i<N;i++)
    app[i]=L+i;

  //味の絶対値が最も小さいりんごを求め>る
  int tmp,bite=300,bitenum;
  for(i=0;i<N;i++){
    tmp = app[i];
    if(tmp<0)
      tmp = -tmp;
    if(tmp<bite){
      bite = tmp;
      bitenum = i;
    }
  }

  //debug
  for(i=0;i<N;i++)
    printf("app[%d]=%d\n",i,app[i]);
  printf("bite=%d\n",bite);

  //パイの味を求める
  int pie=0;
  for(i=0;i<N;i++)
    pie += app[i];
  pie -= app[bitenum];

  //出力して終了
  printf("%d\n",pie);
  return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split(" ");
  var appleNum = Number(input[0]) - 1;
  var azi = Number(input[1]);
  var result = 0;
  var abs = azi;

  for(var i = 0; i <= appleNum ; i++){
    result = result +  (azi + i);
    if(Math.abs(abs) > Math.abs(azi + i)){
      abs = (azi + i);
    }
  }
  console.log(result - abs);
 }
 //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
    input = input.split(" ");
    var N = parseInt(input[0],10);
    var L = parseInt(input[1],10);
    var aziSouwa = [];
    for(var i = 1; i < N+1; i++){
        aziSouwa.push(L + i - 1);
    }    
    var value = 0;
    var diff = [];
    var index = 0;

    aziSouwa.forEach(function(val,i){
    diff[i] = Math.abs(value - val);
    index = (diff[index] < diff[i]) ? index : i;
    });
    aziSouwa.splice(index,1);
    var souwa = aziSouwa.reduce(function(total, data){return total + data});
    console.log(souwa);
};
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  const lines = input.split('\n');
  lines.forEach(line => {
    if (line.length === 0) {
      return;
    }
    const vs = line.split(' ');
    console.log(flow(parseInt(vs[0], 10), parseInt(vs[1], 10)));
  });
}

function flow(length, start) {
  var result = 0;
  var minimum = null;
  for(var i = 1; i <= length; i++) {
    var current = start+i-1;
    if (minimum === null) {
      minimum = current;
    }
    if (Math.abs(minimum) > Math.abs(current)) {
      minimum = current;
    }
    result += start+i-1;
  }
  if (minimum === null) {
    minimum = 0;
  }
  return result - minimum;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [n,l] = nextIntArray()
    let sum = 0
    let min = Number.POSITIVE_INFINITY
    for(let i = 0; i<n;i++){
        let taste = l + i - 1
        sum += taste
        if(Math.abs(min) > Math.abs(taste)){
            min = taste
        }
    }
    console.log(sum - min)
}
Main()
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [n,l] = nextIntArray()
    let sum = 0
    let min = Number.POSITIVE_INFINITY
    for(let i = 0; i<n;i++){
        let taste = l + i - 1
        sum += taste
        if(Math.abs(min) > Math.abs(taste)){
            min = taste
        }
    }
    console.log(sum + min)
}
Main()
//  [javascript]
function Main(input){
	input = input.split(" ").map(Number);
	if(input[1]>=0){
		console.log((input[1]+input[1]+input[0])*(input[0]-1)/2);
	}else if(input[0]+input[1]-1>=0){
		console.log((input[0]+input[1]-2)*input[0]);
	}else{
		console.log((input[1]+input[1]+input[0]-2)/2*(input[0]-1))
	}
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
package main

import "fmt"

func main() {
	var N, L int
	fmt.Scanf("%d %d", &N, &L)
	total := 0
	for i := 1; i <= N; i++ {
		total += L + i - 1
	}
	min := 10000000000000
	minTaste := 0
	for i := 1; i <= N; i++ {
		taste := total - (L + i - 1)
		diff := total - taste
		if diff < 0 {
			diff = -diff
		}
		if diff < min {
			min = diff
			minTaste = taste
		}
	}
	fmt.Println(minTaste)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func chmin(a *float64, b float64) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

func chmax(a *float64, b float64) bool {
	if *a < b {
		*a = b
		return true
	}
	return false
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n, l int
	fmt.Fscan(read, &n, &l)

	sum := 0
	val := 0
	valabs := 10000000.0
	for i := 1; i <= n; i++ {
		sum += l + i - 1
		if chmin(&valabs, math.Abs(float64(l+i-1))) {
			val = l + i - 1
		}
	}
	sum -= val
	fmt.Fprintln(write, sum)
}
//  [go]
package main

import (
  	"sort"
	"fmt"

)
func main() {

	var N,L int

	fmt.Scan(&N,&L)

	aji := make([]int,N)

	for i:=1;i<=N;i++{

		aji[i-1] = L+i-1

	}

	sort.Sort(sort.IntSlice(aji))

	sum :=0

	temp :=0
	min :=0
	index :=0

	if aji[0] > 0{

		for i:=1;i<=len(aji)-1;i++{

			sum = sum + aji[i]
		}

		fmt.Println(sum)

	}else{

		for j:=0;j<len(aji);j++{

			if aji[j] < 0 {

				temp = aji[j] *-1
			
			}else{
				temp = aji[j]

			}

			if j==0{

				min =temp
				
			}else if min >= temp {

			 min = temp

			 index =j
			}

		}
      
		for j:=0;j<len(aji);j++{

			if j != index {

				sum =sum + aji[j]
			}

		}

		fmt.Println(sum)
	}

}
//  [go]
package main

import "fmt"

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	ans := 0
	min := 1000
	for i := 1 ; i  <= n ;i++ {
		ans += l + i - 1
		if  min > abs(l + i - 1 ) {
			min =  abs(l + i - 1 )
		}
	}
	fmt.Println(ans - min)
}
func abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N, L int
	fmt.Scan(&N, &L)

	allSum := (L + L + N - 1) * N / 2

	if L+N-1 <= 0 {
		fmt.Println(allSum - L + N - 1)
	} else if L >= 0 {
		fmt.Println(allSum - L)
	} else {
		fmt.Println(allSum)
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N, L int
	fmt.Scan(&N, &L)

	allSum := (L + L + N - 1) * N / 2
	//	fmt.Println(allSum)
	if N >= 0 && L >= 0 {
		fmt.Println(allSum - L)
	} else if L < 0 && L+N-1 > 0 {
		fmt.Println(0)
	} else {
		fmt.Println(allSum - (L + N - 1))
	}
}
//  [ruby]
n,l = gets.chomp.split.map(&:to_i)

pai = []

(1..n).each do |i|
  pai.push(l + i -1)
end

puts pai.inject(:+) - pai.min_by{|x| (x-0).abs}
//  [ruby]
n, l = gets.chomp.split.map(&:to_i)

vals = (1..n).map { |i| l + i - 1 }
min = vals.min_by { |v| v.abs }

puts vals.reduce(:+) - min
//  [ruby]
n, l = gets.chomp.split.map(&:to_i)
bf = n * (l + l + n - 1) / 2
af = (l...l + n).to_a
af.sort_by! {|t| t.abs }
puts bf - af[0]
//  [ruby]
n,l = gets.chomp.split(' ').map(&:to_i)
apples = (l...(l+n)).to_a
choice = apples.map{|a|a.abs}.min
puts apples.sum - choice
//  [ruby]
n,l = gets.strip.split.map(&:to_i)
ary = Array.new(n,0)
for i in 1..n
  ary[i] = (l-1+i).abs
end
puts (n-1)*(l-1)+n*(n+1)/2-(ary.index(ary.min))-1
//  [ruby]
n,l=gets.split.map &:to_i
a=(l..n+l-1).to_a
max=a[0]
a.each{|i|
max=[i.abs,max.abs].min==i.abs? i : max
}
puts a.sum-max
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i32 = read();
    let l: i32 = read();
    let left = l;
    let right = l + n - 1;

    let eat = if right <= 0 {
        right
    } else if left >= 0 {
        left
    } else {
        0
    };

    let ans = (right + left) * (right - left + 1) / 2 - eat;

    println!("{}", ans);
}
//  [rust]
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: i32 = read();
    let l: i32 = read();
    let mut min:i32 = 400;
    let mut mini:i32 = 400;
    let mut sum = 0;
    for i in 0..n{
	let  number = l+i;
	sum += number;
	
	let absnum = if number < 0 {number*-1 } else {number};
	min = if absnum < min { mini = number; absnum} else {min}
    }
    println!("{}",sum-mini);
}
//  [rust]
use std::io::stdin;

fn main() {
    let mut x = String::new();
    stdin().read_line(&mut x).unwrap();
    let x: Vec<isize> = x.trim().split_whitespace().flat_map(str::parse).collect();
    let (n, l) = (x[0], x[1]);

    let mut tastes: Vec<(isize, isize)> = (1..n+1)
        .map(|i| l + i - 1)
        .map(|i| (if i < 0 { -i } else { i }, i))
        .collect();
    tastes.sort();
    println!("{}", tastes.into_iter().skip(1).map(|(_, i)| i).sum::<isize>());
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:i64 = read();
    let l:i64 = read();
    let left = l;
    let right = l - n - 1;

    let eat = if right <= 0 {
        right
    } else if left >= 0 {
        left
    } else {
        0
    };
    let ans = (right+left) * (right - left + 1) / 2 - eat;
    println!("{}", ans);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:i64 = read();
    let l:i64 = read();
    let mut ans:i64 = (0..n).map(|x| l-x).collect::<Vec<i64>>().iter().sum();
    let left = l;
    let right = l - n - 1;

    let eat = if right <= 0 {
        right
    } else if left >= 0 {
        left
    } else {
        0
    };
    println!("{}", ans - eat);
}
//  [rust]
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let l: i32 = read();
    let arr: Vec<i32> = (1..=n).map(|x| x as i32 + l - 1).collect();
    let standard: i32 = arr.iter().sum();
    let mut ans = std::i32::MAX;
    for i in arr {
        ans = min((standard - (standard - i)).abs(), ans);
    }
    println!("{}", standard - ans);
}
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
    
let nl = readInts()
let n = nl[0]
let l = nl[1]
var valueall=0
for i in 1...n{
  valueall+=(l+i-1)
}
var first=1
for i in 1...n{
  if abs(l+i-1)<abs(l+first-1){
    first=i
  }
}
print(valueall-l-first+1)
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let nab=readInts()
let n=nab[0]
let l=nab[1]
var sum=0
var min=l
for i in 2...n{
  var c=l+i-1
  sum+=c
  if(abs(c)<abs(min)){sum-=c
                      sum+=min
                      min=c
                      }
}

print(sum)
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let suuji = readInts()
let n = suuji[0]
let l = suuji[1]
var sum = 0
var min = l
for i in 2...n {
  var b = l + i - 1
  sum+=b
  if (abs(b)<abs(min)) {
    sum-=b
    sum+=min
    min=b
  }
}
print(sum)
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let suuji = readInts()
let n = suuji[0]
let l = suuji[1]
var sum = 0
var min = l
for i in 2...n {
  var b = l + i - 1
  sum+=b
  if (abs(b)<abs(min)) {
    sum-=b
    sum+=min
  }
}
print(sum)
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let a = readInts() 
    let n = a[0]
    let l = a[1]
    let sum = l * n + n * (n - 1) / 2
    var dmin = Int.max
    var closest = 0
    for i in 0..<n {
        let tmp = sum - (l + i)
        let d = abs(sum - tmp)
        if d < dmin {
            dmin = d
            closest = tmp
        }
    }
    print(closest)
}

main()
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var n = arr[0]
var l = arr[1]
var i = 0
var min : Int
var o = 0

min = abs( l + i + 1)
for i in 1...n {
  o += l + i - 1
  if( abs( l + i - 1)  < abs(min) ) { min = l + i - 1   }
}

print( o - min )
//  [typescript]
export class Main {
  static main(input): string {
    const [n, l]: number[] = input.split("\n")[0].split(" ").map(a => parseInt(a));
    if (l < 0 && 0 <= n + l - 1) {
      let result = 0;
      for (let i = 1; i <= n; ++i) {
        result += i + l - 1;
      }
      return `${result}`;
    } else if (l < 0) {
      let result = 0;
      for (let i = 1; i < n; ++i) {
        result += i + l - 1;
      }
      return `${result}`;
    } else {
      let result = 0;
      for (let i = 2; i <= n; ++i) {
        result += i + l - 1;
      }
      return `${result}`;
    }
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let [n,l]=t.n(2)
  l--;
  let d=t.abs(1+l);
  let a=1;
  for(let i=2;i<=n;i++){
    if(d>t.abs(i+l)){
      d=t.abs(i+l)
      a=i;
    }
  }
  let ans=0;
  for(let i=1;i<=n;i++){
    if(i==a)continue
    ans+=i+l;
  }
  t.o(ans)
}
main()
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");

const [n, l]: number[] = input[0].split(' ').map((x: string): number => +x);
let total: number = 0;
for(let i = l; i < n+l; i++){
    total += i;
}

if(l >= 0){
    console.log(total - l);
}else if (l < 0 && n+l-1 >= 0){
    console.log(total);
}else{
    console.log(total - (n+l-1));
}
//  [typescript]
const main = (lines: string) => {
  const data = lines.split(" ");
  const appleLength = parseInt(data[0], 10);
  const tastePoint = parseInt(data[1], 10);

  let tasteTotalValue = 0;
  let minTaste = 0;

  if (appleLength + tastePoint - 1 <= 0) {
    minTaste = Math.abs(appleLength + tastePoint - 1);
  } else if (tastePoint >= 0) {
    minTaste = Math.abs(tastePoint);
  }

  // 等差数列の和
  tasteTotalValue = (appleLength * (2 * tastePoint + appleLength - 1)) / 2;

  console.log(tasteTotalValue - minTaste);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const main = (lines: string) => {
  const data = lines.split(" ");
  const appleLength = parseInt(data[0], 10);
  const tastePoint = parseInt(data[1], 10);
  let tastePoints: number[] = [];
  let taste;
  let tasteTotalValue = 0;

  for (let i = 1; i <= appleLength; i++) {
    tastePoints.push(Math.abs(i + tastePoint - 1));
    tasteTotalValue += i + tastePoint - 1;
  }

  console.log(tasteTotalValue - Math.min.apply(null, tastePoints));
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
r,d,x = map(int,input().split())
for i in range(10):
    x = r * x - d
    print(x)
//  [python]
r, D, x = [int(i) for i in input().split()]

for _ in range(10):
    y = r * x - D
    print(y)
    x = y
//  [python]
r,d,x = map(int, input().split())

for i in range(10):
  x = r*x - d
  print(x)
//  [python]
a,b,c = map(int,input().split())
for i in range(b):
    c = a*c-b
    print(c)
//  [python]
r, d, x = map(int, input().split())

for i in range(11):
  x = r * x - d
  print(x)
//  [python]
#ABC127 B

r,D,x = map(int,input().split())
A = []
for i in range(10):
    if i == 0:
        A.append(x)
    else:
        A.append(r*(A[i-1])-D)

for j in range(10):
    print(A[j])