jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

const int mod=1e9+7;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}

void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}

int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );

  string s;
  cin>>s;
  
  int year=stoi(s.substr(0,4));
  int mon=stoi(s.substr(5,7));
  int day=stoi(s.substr(8,10));
  string ans="Heisei";
  if(year>2019)ans="TBD";
  else if(year==2019){
    if(mon>4)ans="TBD";
  }

  cout<<ans<<endl;

  return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	if (s <= "2019/04/30") cout << "Heisei" << endl;
	else cout << "TBD" << endl;
	
	return 0;
}
//  [c]
#include <stdio.h>

int main()
{
	char S[12];
	scanf("%s", S);
	if (10 * (S[5] - '0') + S[6] - '0' <= 4) printf("Heisei\n");
	else printf("TBD\n");
	fflush(stdout);
	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d/%d/%d",&a,&b,&c);
	if(b<=4) printf("Heisei\n");
	else printf("TBD\n");
	return 0;
}
//  [c]
#include<stdio.h>

int main(void){
  char s[100];
  scanf("%s",s);
  if(s[5]=='0' && s[6]<='4'){
    printf("Heisei\n");
  }else{
    printf("TBD\n");
  }
  return 0;
}
//  [javascript]
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const nenn = Number(input.split('').slice(0, 4).join(''));

const month = Number(input.split('').slice(5, 7).join(''));

const hi = Number(input.split('').slice(8, 10).join(''));

if (nenn < 2019) {
  console.log('Heisei');
} else if(month < 5) {
  console.log('Heisei');
} else {
  console.log('TBD');
}
//  [javascript]
function main(arg) {
	arg = arg.split("\n")[0]
	arg = Number(arg.split("/").join(""))

	if (arg <= 20190430) {
		console.log("Heisei")
	} else {
		console.log("TBD")
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input){
    i=input.split("/").map(Number);
    if(i[0]<2019)console.log("Heisei");
    else if(i[0]===2019&&i[1]<4)console.log("Heisei")
    else if(i[0]===2019&&i[1]===4&&i[2]<=30)console.log("Heisei")
    else console.log("TBD")
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"time"
)

func main() {
	var s string
	fmt.Scan(&s)
	t, _ := time.Parse("2006/01/02", s)
	d, _ := time.Parse("2006/01/02", "2019/04/30")

	if t.Before(d) || t.Equal(d) {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}
//  [go]
package main

import (
	"fmt"
	"strconv"
)

func main() {
	// Code for A - Still TBD
	var S string
	fmt.Scanf("%s", &S)

	yyyy, _ := strconv.Atoi(S[0:4])
	mm, _ := strconv.Atoi(S[5:7])
	if yyyy <= 2018 {
		fmt.Println("Heisei")
	} else if yyyy == 2019 && mm <= 4 {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}
//  [go]
package main

import (
	"fmt"
	"strconv"
	"strings"
	"time"
)

func main() {

	var S string
	fmt.Scan(&S)
	arr := strings.Split(S, "/")
	year, _ := strconv.Atoi(arr[0])
	month, _ := strconv.Atoi(arr[1])
	day, _ := strconv.Atoi(arr[2])
	t := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.Local)
	lastHeiseiDate := time.Date(2019, time.Month(4), 30, 0, 0, 0, 0, time.Local)
	if int(lastHeiseiDate.Sub(t)) >= 0 {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end
require 'date'

S = gets.chomp

if Date.parse(S) <= Date.parse('2019/04/30')
  puts 'Heisei'
else
  puts 'TBD'
end
//  [ruby]
require 'date'
puts Date.parse(gets.chomp) <= Date.parse("2019/04/30") ? 'Heisei' : 'TBD'
//  [ruby]
require 'date'
a,b,c=gets.split('/').map(&:to_i)
puts Date.new(a,b,c)<=Date.new(2019,4,30) ?'Heisei':'TBD'
//  [rust]
fn main() {
    proconio::input!(
        s: String
    );
    let s: String = s;
    let date: Vec<usize> = s.split("/").map(|c| c.parse::<usize>().unwrap()).collect();
    let ans = if let [y, m, _d] = date[..] {
        if y > 2019 || (y == 2019 && m > 4) {
            "TBD"
        } else {
            "Heisei"
        }
    } else {
        ""
    };
    println!("{}", ans);
}
//  [rust]
use proconio::{fastout, input};
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        s: String
    };

    let mut set = BinaryHeap::new();
    set.push("2019/04/30");
    set.push(&s);

    if set.pop().unwrap() != "2019/04/30" && s != "2019/04/30" {
        println!("TBD")
    } else {
        println!("Heisei")
    }
}
//  [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("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 s: String = read();
    let s1 = &s[0..4];
    let num1: i32=s1.parse().unwrap();
    if(num1<2019){
        println!("Heisei");
        return;
    }
    let s2 = &s[5..7];
    let num2: i64=s2.parse().unwrap();
    if(num2<=4){
        println!("Heisei");
        return;
    }
    println!("TBD");
}
//  [swift]
import Foundation
let m = readLine()!.componentsSeparatedByString("/").map{Int($0)!}[1]
if m <= 4 {
    print("Heisei")
} else {
  	print("TBD")
}
//  [swift]
import Foundation

extension String {
    func split(separator: String) -> [Int] {
        return self.componentsSeparatedByString(separator).map { Int($0)! }
    }
}

let input = readLine()!.split("/")
let month = input[1]

var result = "TBD"
if month <= 4 {
    result = "Heisei"
}

print(result)
//  [swift]
import Foundation

let input = readLine()!.componentsSeparatedByString("/").map { Int($0)! }
let month = input[1]

if month <= 4 {
    print("Heisei")
} else {
  	print("TBD")
}
//  [typescript]
namespace Coder {
  class Scanner {
    private buffer: string = '';
    private stdinQueue: any = [];

    constructor() {
      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdin.on(
        'data',
        (chunk): void => {
          this.buffer += chunk;
          while (this.stdinQueue.length > 0) {
            const i = this.buffer.indexOf('\n');
            if (i < 0) {
              break;
            }
            let line = this.buffer.substr(0, i);
            if (line.endsWith('\r')) {
              line = line.slice(0, -1);
            }
            this.buffer = this.buffer.substr(i + 1);
            this.stdinQueue.shift()(line);
          }
        },
      );
    }
    public getLine(): Promise<string> {
      return new Promise((resolve, reject) => {
        const i = this.buffer.indexOf('\n');
        if (i >= 0 && this.stdinQueue.length == 0) {
          let line = this.buffer.substr(0, i);
          if (line.endsWith('\r')) {
            line = line.slice(0, -1);
          }
          this.buffer = this.buffer.substr(i + 1);
          resolve(line);
        } else {
          this.stdinQueue.push(resolve);
        }
      });
    }

    public close(): void {
      process.stdin.pause();
    }
  }

  async function slove() {
    const sc = new Scanner();
    const S = (await sc.getLine()).split('/');
    if (Number(S[0]) > 2019) {
      console.log('TBD');
    } else {
      if (Number(S[1]) > 4) {
        console.log('TBD');
      } else if (Number(S[1]) === 4 && Number(S[2]) <= 30) {
        console.log('Heisei');
      } else {
        console.log('Heisei');
      }
    }
    sc.close();
  }

  slove();
}
//  [typescript]
function readLines(): Promise<string[]> {
    return new Promise((resolve) => {
        process.stdin.resume();
        process.stdin.setEncoding("utf8");
        let buffer = "";
        process.stdin.on("data", chunk =>
            buffer += chunk
        );
        process.stdin.on("end", () =>
            resolve(buffer.split("\n"))
        );
    });
}

readLines().then(lines => {
    const s = new Date(lines[0]);
    const d = new Date("2019/4/30");
    if (s <= d) {
        console.log("Heisei");
    } else {
        console.log("TBD");
    }
});
//  [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 main = ()=>{
  new Date(sin()) <= new Date('2019/04/30') ? out('Heisei') : out('TBD');
}
main();
//  [python]
x = int(input())

def fun(x):

    res = []

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            mult = a**5 - b**5
            if mult == x:
                res = a, b
                break
    print(res[0], res[1])

fun(x)
//  [python]
import sys
 
x = int(input())
 
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(130):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()
//  [python]
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
X=int(input())
lst=[]
N=500000
for i in range(-N,N+1):
    lst.append([i**5,i])
B=set([A for A,a in lst])
dic=defaultdict(int)
for A,a in lst:
    dic[A]=a
for A,a in lst:
    if A-X in B:
        print(a,dic[A-X])
        exit()
//  [java]
/*package whatever //do not write package name here */
import java.util.*;
import java.lang.Math;
import java.io.*;

class Main {
	public static void main (String[] args) {
// 		System.out.println("GfG!");
		Scanner input=new Scanner(System.in);
		double n=input.nextDouble();
		outer:for(double i=0;i<=100000;i++)
		{
		    for(double j=-100000;j<=100000;j++)
		    {
		        if((Math.pow(i,5)-Math.pow(j,5))==n)
		        {
		            System.out.println((int)i + " " + (int)j);
		            break outer;
		        }
		    }
		}
		input.close();
	}
}
//  [java]
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long X = scanner.nextLong();
        Map<Long, Pair> map = new HashMap<>();
        for (long i = -600; i <= 600; i++) {
            long ii = i * i * i * i * i;
            for (long j = -600; j <= 600; j++) {
                map.put(ii - j * j * j * j * j, new Pair(i, j));
            }
        }
        Pair pair = map.getOrDefault(X, new Pair(-9999, -9999));
        if(pair.a == -9999) throw new RuntimeException("aaa");
        System.out.println(pair.a);
        System.out.println(pair.b);
    }

    class Pair {
        long a;
        long b;

        Pair(long a, long b) {
            this.a = a;
            this.b = b;
        }
    }
}
//  [java]
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        BigInteger X = BigInteger.valueOf(x);
        for(int a = -1000;a<=1000;a++){
            for(int b=-1000;b<=1000;b++){
                BigInteger A = BigInteger.valueOf(a);
                A = A.pow(5);
                BigInteger B = BigInteger.valueOf(b);
                B = B.pow(5);
                if(A.subtract(B).equals(X)){
                    System.out.println(a+" "+b);
                    return;
                }
            }
        }
        throw new Error();
    }

    public static void main(String[] args) {
        new Main();
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;


int main(){



  int64_t x;
  cin>>x;

  int64_t rootx=0;
  while (rootx*rootx<=x){
    rootx++;
  }
  
  rootx--;
  

  
  vector<int64_t> factors(0);
  

  
  
  
  
  
  for (int64_t i=1;i<=rootx;i++){
    if (x%i==0){
      factors.push_back(i);
      if (i!=x/i){
        factors.push_back(x/i);
      }
    }
  }
  

  
  
  
  int64_t a=1;
  int64_t b=0;
  
  
  int64_t size=int64_t(factors.size());
  for (int64_t i=0;i<size;i++){
    int64_t d=factors.at(size-1-i);
    
    int64_t flag=1;
    
    int64_t tmp=0;
    
    
    
    while (tmp-d<120 ){
      if (tmp*tmp*tmp*tmp*tmp-(tmp-d)*(tmp-d)*(tmp-d)*(tmp-d)*(tmp-d)==x){
        a=tmp;
        b=a-d;
        flag=0;
        break;
      }
      
      else {
        tmp++;
      }
    }
    
    if (flag==0){
      break;
    }
    
  }
  
  
  cout<<a<<" "<<b<<endl;
  
  
  
  
  
    
      
      

  
  
  
    
    
    
        
      
    
  
  
  
  
    
  
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){
  int x,i,j;

  if(scanf("%d",&x)==1){}

  for(i=-1000;i<1000;i++){
    for(j=-1000;j<1000;j++){
      if(pow((double)i,5.0)-pow((double)j,5.0)==(double)x){
	printf("%d %d\n",i,j);
        return 0;
      }
    }
  }
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){
    int x;
    scanf("%d",&x);
    for(int i=-1000; i<1000; i++){
        for(int j=-1000; j<1000; j++){
            if(pow(i,5)-pow(j,5)==x){
                printf("%d %d\n",i,j);
                return 0;
            }
        }
    }
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main(void){
int x;
scanf("%d",&x);
if(x==1){printf("1 0");return 0;}
int a,b;
 
for(int i=-1000;i<=1000;i++){
    for(int j=-1000;j<=1000;j++){
            if((long long int)pow(i,5)-(long long int)pow(j,5)==(long long int)x){printf("%d %d\n",i,j); return 0;}
        }
    }
}
//  [javascript]
function main(input) {
  const x = BigInt(input[0]);
  let power5 = [];
  const width = ((x<100)?x:1000);

  for(let i=-width;i<width;i++){
    power5[i+width]=BigInt(i*i*i*i*i);
  }
  let judge = false;
  for(let i=-width;i<width;i++){
    for(let j=-width;j<width;j++){
      if((power5[i+width]-power5[j+width])===x){
        console.log(i + " " + j);
        judge = true;
        break;
      }
    }
    if(judge){
      break;
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
//  [javascript]
function main(input) {
  var x = parseInt(input.split("\n")[0], 10);

  var hoge = [];
  for (var i = 0; i < 150; i++) {
    hoge.push(Math.pow(i, 5));
  }
  var fuga = hoge.concat();

  for (var i = 0; i < hoge.length; i++) {
    for (var j = 0; j < fuga.length; j++) {
      var a5 = hoge[i];
      var b5 = fuga[j];
      
      if (a5 - b5 == x) {
        console.log(i + " " + j);
        return;
      }

      b5 = b5 * -1;
      if (a5 - b5 == x) {
        console.log(i + " " + "-" + j);
        return;
      }
    }
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let X = +cin.shift();
    for (let a = -120; a < 120; a++) {
        for (let b = -120; b < 120; b++) {
            if (a ** 5 - b ** 5 == X) {
                console.log(a, b);
                return;
            }
        }
    }
}
main();
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var X int
	fmt.Scan(&X)

LOOP:
	for A := -2500; A < 2500; A++ {
		for B := -2500; B < 2500; B++ {
			if int(math.Pow(float64(A), 5)-math.Pow(float64(B), 5)) == X {
				fmt.Println(A, B)
				break LOOP
			}
		}
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	x := readInt()

	for i := -1000; i <= 1000; i++ {
		for j := -1000; j <= 1000; j++ {
			if math.Pow(float64(i), 5)-math.Pow(float64(j), 5) == float64(x) {
				fmt.Printf("%d %d", i, j)
				return
			}
		}
	}
}
//  [go]
package main

import(
	"fmt"
	"math"
)

func main() {
	var X, ans1, ans2 int
  fmt.Scan(&X)
	N:=1000
	findFlag:=false
	for ans1 =-N; ans1<N; ans1++ {
		for ans2 =-N; ans2<N; ans2++ {
          num := int(math.Pow(float64(ans1),5)-math.Pow(float64(ans2),5))
			if num == X {
              fmt.Print(ans1, ans2)
              findFlag = true
				break
			}
		}
		if findFlag == true {
			break
		}
	}
}
//  [ruby]
x = gets.chomp
hash = {}
for i in (-500)..500
  for j in (-500)..500
    hash[(i ** 5 - j ** 5).to_s] = "#{i} #{j}"
  end
end
puts hash[x]
//  [ruby]
n = gets.to_i
res = nil
5000.times do |a|
  break unless res.nil?
  a -= 2500
  5000.times do |b|
    break unless res.nil?
    b -= 2500
    # puts "#{a**5} - #{b**5} = #{a**5 - b**5}(#{n})"
    res = [a, b] if a**5 - b**5 == n
  end
end

res = [0, 0] if res.nil?
puts res.join(' ')
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

X=gets.to_i
root5=(X**(1.0/5.0)).to_i**2
table=array(root5+1,0)
1.upto(root5) do|i|
    table[i]=i**5
end
ans=nil
0.upto(root5) do|x|
  0.upto(root5) do|y|
    if table[x]-table[y]==X
        ans=[x,y]
    elsif table[x]+table[y]==X
        ans=[x,-y]
    end
  end
end
puts ans.join(" ")
//  [rust]
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
   input! {
      x:i128
   }
   let mut table = vec![];
   for i in -10000..=10000_i128 {
      table.push(i.pow(5_u32));
   }
   let mut ic = -10000;
   for &i in &table {
      let mut jc = -10000;
      for &j in &table {
         if i - j == x {
            println!("{} {}", ic, jc);
            return;
         }
         jc += 1;
      }
      ic += 1;
   }
}
//  [rust]
/* #region template */
#![allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, Bytes, Read, Stdin, StdinLock, Stdout, StdoutLock, Write};
use std::iter::{repeat, repeat_with};
use std::mem::swap;
use std::str::FromStr;
#[allow(dead_code)]
struct Io<'a> {
    reader: Bytes<StdinLock<'a>>,
    writer: StdoutLock<'a>,
    in_buf: [u8; BUF_SIZE],
}
#[allow(dead_code)]
impl<'a> Io<'a> {
    fn new(stdin: &'a Stdin, stdout: &'a Stdout) -> Io<'a> {
        Io {
            reader: stdin.lock().bytes(),
            writer: stdout.lock(),
            in_buf: [0; BUF_SIZE],
        }
    }
    fn r<T: FromStr>(&mut self) -> T {
        let mut count = 0;
        loop {
            match self.reader.next() {
                Some(Ok(b' ')) | Some(Ok(b'\n')) => break,
                Some(Ok(c)) => self.in_buf[count] = c,
                _ => panic!(),
            }
            count += 1;
        }

        let s = unsafe { std::str::from_utf8_unchecked(&self.in_buf[0..count]) };
        s.parse().unwrap_or_else(|_| panic!())
    }
    fn ru(&mut self) -> usize {
        self.r()
    }
    fn iter<'b, T>(&'b mut self) -> IoIter<'a, 'b, T> {
        IoIter::new(self)
    }
    fn c<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        self.iter().take(n).collect()
    }
    fn cu(&mut self, n: usize) -> Vec<usize> {
        self.c(n)
    }
    fn w<T: std::fmt::Display>(&mut self, v: T) {
        writeln!(self.writer, "{}", v).unwrap();
    }
    fn wn<T: std::fmt::Display>(&mut self, v: T) {
        write!(self.writer, "{}", v).unwrap();
    }
}
#[allow(dead_code)]
struct IoIter<'a: 'b, 'b, T> {
    io: &'b mut Io<'a>,
    m: std::marker::PhantomData<T>,
}
#[allow(dead_code)]
impl<'a: 'b, 'b, T> IoIter<'a, 'b, T> {
    fn new(io: &'b mut Io<'a>) -> IoIter<'a, 'b, T> {
        IoIter {
            io,
            m: std::marker::PhantomData,
        }
    }
}
impl<'a, 'b, T: FromStr> Iterator for IoIter<'a, 'b, T> {
    type Item = T;
    fn next(&mut self) -> Option<Self::Item> {
        Some(self.io.r())
    }
}
fn main() {
    let stdin = stdin();
    let stdout = stdout();
    let mut io = Io::new(&stdin, &stdout);
    unsafe {
        solve(&mut io);
    }
}
/* #endregion */

const BUF_SIZE: usize = 1024;

unsafe fn solve(io: &mut Io) {
    let x: i128 = io.r();
    for i in 1..(x as f64).sqrt() as i128 + 1 {
        if x % i == 0 {
            check(x, i, io);
            if i != x / i {
                check(x, x / i, io);
            }
        }
    }
    unreachable!();
}

fn check(x: i128, i: i128, io: &mut Io) {
    let mut a = i / 2;
    let mut b = a - i;

    while check2(x, a, b, io) {
        a += 1;
        b += 1;
    }
}

fn check2(x: i128, a: i128, b: i128, io: &mut Io) -> bool {
    let res = (a - b) * (a.pow(4) + a.pow(3) * b + a.pow(2) * b.pow(2) + a * b.pow(3) + b.pow(4));
    if res == x {
        io.wn(a);
        io.wn(' ');
        io.w(b);
        std::process::exit(0);
    } else if res > x {
        false
    } else {
        true
    }
}
//  [rust]
#![allow(dead_code)]
use crate::scanner::Scanner;
use num_bigint::{BigInt, ToBigInt};
fn main() {
    let mut scan = Scanner::new();
    let x = scan.read::<i64>().to_bigint().unwrap();
    for a in -120..=120 {
        for b in -120..=120 {
            let p: BigInt = a.to_bigint().unwrap();
            let q: BigInt = b.to_bigint().unwrap();
            if p.clone() * p.clone() * p.clone() * p.clone() * p.clone()
                - q.clone() * q.clone() * q.clone() * q.clone() * q.clone()
                == x
            {
                println!("{} {}", a, b);
                return;
            }
        }
    }
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
    }
}
//  [swift]

//PDF解説より、ある範囲で全探索すれば解けるのでそれを実直に実装
import Foundation
var X: String = readLine()!
var x: Int = Int(X)!
var flag = false
for i in -200...200{
  for j in -200...200{
    if pow(Double(i),5)-pow(Double(j),5)==Double(x){
      flag = true
      print(i,j)
      break
    }
  }
  if flag{
    break
  }
}
//  [swift]
import Foundation
var X: String = readLine()!
var x: Int = Int(X)!
var flag = false
for i in -200...200{
  for j in -200...200{
    if pow(Double(i),5)-pow(Double(j),5)==Double(x){
      flag = true
      print(i,j)
      break
    }
  }
  if flag{
    break
  }
}
//  [swift]
import Foundation
 
let c = Int(readLine()!)!
 
for_i: for a in -100 ..< 10000 {
    for b in -100 ..< 10000 {
        if a*a*a*a*a - b*b*b*b*b == c{
            print(String(format: "%d %d",a,b))
            break for_i
        }
    }
}
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const x = parseInt(args[0][0]);

const f = (a: number, b: number) => Math.pow(a, 5) - Math.pow(b, 5);

let [a, b] = [0, 0];
let tmp = 1;
if (f(a, b) !== x) {
    while (true) {
        if (tmp % 2 === 1) {
            for (let i = 1; i <= tmp; i++) {
                [a, b] = [a + 1, b];
                if (f(a, b) === x) break
            }

            if (f(a, b) === x) break

            for (let i = 1; i <= tmp; i++) {
                [a, b] = [a, b - 1];
                if (f(a, b) === x) break
            }
        } else {
            for (let i = 1; i <= tmp; i++) {
                [a, b] = [a - 1, b];
                if (f(a, b) === x) break
            }

            if (f(a, b) === x) break

            for (let i = 1; i <= tmp; i++) {
                [a, b] = [a, b + 1];
                if (f(a, b) === x) break
            }
        }

        tmp++;
    }
}

console.log(`${a} ${b}`);
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const x = parseInt(args[0][0]);

const f = (a: number, b: number) => Math.pow(a, 5) - Math.pow(b, 5);

let [a, b] = [0, 0];
let tmp = 1;
while (f(a, b) !== x) {
    if (tmp % 2 === 1) {
        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a + 1, b];
            if (f(a, b) === x) break
        }

        if (f(a, b) === x) break

        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a, b - 1];
            if (f(a, b) === x) break
        }
    } else {
        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a - 1, b];
            if (f(a, b) === x) break
        }

        if (f(a, b) === x) break

        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a, b + 1];
            if (f(a, b) === x) break
        }
    }

    tmp++;
}

console.log(`${a} ${b}`);
//  [typescript]
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const x = Number(inputs[0]);

  let a = 0;
  let num = 0;

  if (x === 0) {
    showLog(0, 0);
    return;
  }

  while (num !== x) {
    a++;
    for (let b = -1 * a + 1; b < a; b++) {
      num = calc(a, b);
      if (num === x) {
        showLog(a,b);
        return;
      }
    }
  }
}

function showLog(a: number, b: number): void {
  console.log(a + ' ' + b);
}

function calc(a: number, b: number): number {
  return Math.pow(a, 5) - Math.pow(b, 5);
}
//  [python]
n=int(input())
a=list(map(int,input().split()))

mod=10**9+7
import numpy as np

cum=[]

prev=0
for i in range(n):
    tmp = prev%mod +a[i]%mod
    cum.append(tmp)
    prev = cum[-1]


ans=0
for i in range(n-1):
    p=a[i]
    t = cum[-1] - cum[i]

    ans+=(p*t)%mod

print(ans%mod)
//  [python]
n = int(input())
arr  = input().split(" ")
s = int(arr[-1])
mod = 10**9 +7
ans  = 0

def moduloMultiplication(a, b, mod): 
    res = 0; 
    a = a % mod; 
    while (b): 
        if (b & 1): 
            res = (res + a) % mod; 
        a = (2 * a) % mod; 
  
        b >>= 1;
      
    return res; 

for i in range(len(arr)-2, -1, -1):
    t = int(arr[i])
    ans = (ans+  moduloMultiplication(s,t,mod))%mod
    s = (s+t)
print( ans)
//  [python]
import math

class BitIndexedTree:
	'''NOTES: 1-origin-indexed
	'''
	def __init__(self, itemCount):
		self.itemCount = itemCount
		self.items = [0 for i in range(itemCount+1)]

	def add(self, i,value):
		while i <= self.itemCount:
			self.items[i] += value
			i += (i & (-i))

	def sumFromStart(self, end):
		summary = 0
		i = end
		while i > 0:
			summary += self.items[i]
			i -= (i & (-i))
		return summary

	def sum(self, start,end):
		summary = self.sumFromStart(end) - self.sumFromStart(start-1)
		return summary

if __name__ == "__main__":
	MOD = 10 ** 9 + 7
	N=int(input())
	A=list(map(int,input().split()))

	BIT=BitIndexedTree(N)

	for n in range(N):
		BIT.add(n+1, A[n])

	ans = 0
	for n in range(N-1):
		# print(A[n],BIT.sum(n+2,N),A[n] * BIT.sum(n+2,N))
		# print(MOD)
		ans += ((A[n] * BIT.sum(n+2,N)) % MOD)


	print(ans % MOD)
//  [java]
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		BigDecimal[] b = new BigDecimal[a];

		for (int i = 0; i < a; i++) {
			b[i] = sc.nextBigDecimal();
		}

		BigDecimal[] c = new BigDecimal[a];

		for (int i = a - 1; i >= 0; i--) {
			if (i < a - 1) {
				c[i] = c[i + 1].add(b[i]);
			} else {
				c[i] = b[i];
			}
		}
		
		BigDecimal answer = new BigDecimal("0");
		
		for (int i = a - 2; i >= 0; i--) {
			answer = answer.add(b[i].multiply(c[i + 1]));
		}

		answer = answer.remainder(new BigDecimal("1000000007"));

		System.out.println(answer);
	}
}
//  [java]
import java.util.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt(), zeroCount = 0;
		int[] arr2 = new int[n];
		for (int i = 0; i < n; i++) {
			arr2[i] = reader.nextInt();
			if (arr2[i] == 0) {
				zeroCount++;
			}
		}
		int[] arr = new int[n - zeroCount];
		if (arr.length < 2) {
			System.out.println(0);
		}
		else {
			int encountered = 0;
			for (int i = 0; i < arr2.length; i++) {
				if (arr2[i] == 0) {
					encountered++;
				}
				else {
					arr[i - encountered] = arr2[i];
				}
			}
			long ret = 0;
			BigInteger modThing = new BigInteger("" + ((int) Math.pow(10, 9) + 7));
			BigInteger prev = (new BigInteger("" + arr[arr.length - 2])).multiply(new BigInteger("" + arr[arr.length - 1]));
			BigInteger fakePrev = new BigInteger("0");
			ret += prev.mod(modThing).intValue();
			ret %= Math.pow(10, 9) + 7;
			for (int i = arr.length - 3; i >= 0; i--) {
				BigInteger single = (new BigInteger("" + arr[i])).multiply(new BigInteger("" + arr[i + 1]));
				BigInteger newOne = prev.multiply(new BigInteger("" + arr[i])).divide(new BigInteger("" + arr[i + 1]));
				prev = single.add(newOne);
				ret += prev.mod(modThing).intValue();
				ret %= Math.pow(10, 9) + 7;
			}
			
			System.out.println(ret);
		}
		reader.close();
	}
	
}
//  [java]
import java.util.*;
import java.math.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt();
        int[] array = new int[size];
        for(int i = 0; i < size; i++){
            array[i] = sc.nextInt();
        }
        System.out.println(solve(array));
    }

    public static long solve(int[] array){
        BigInteger sum = new BigInteger("0");
        BigInteger modulo = new BigInteger("1000000007");
        BigInteger newSum = new BigInteger("0");
        BigInteger product = new BigInteger("1");
        if(array.length == 1){
            return array[0];
        }
        for(int i = 0; i < array.length; i++) {
            sum = sum.add(new BigInteger(String.valueOf(array[i])));
        }
        for(int i = 0; i < array.length; i++) {
            BigInteger remainingSum = sum.subtract(new BigInteger(String.valueOf(array[i])));
            sum = remainingSum;
            product = remainingSum.multiply(new BigInteger(String.valueOf(array[i])));
            newSum = newSum.add(product);
        }
        BigInteger result = newSum.mod(modulo);
        return Long.parseLong(result.toString());
    }
}
//  [cpp]
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

const ll MOD=1e9+7;

int main(){
  int n;
  cin>>n;
  
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  
  ll sum=0,sum2=0;
  
  rep(i,n){
    sum=(sum+A[i])%MOD;
    sum2=(sum2+A[i]*A[i]%MOD)%MOD;
  }
  
  ll ans;
  rep(i,MOD){
    if((2*i+sum2)%MOD==sum*sum%MOD) ans=i;
  }
  cout<<ans<<endl;
  
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> sum(n, 0);
    REP(i, n) {
        cin >> a[i];
    }
    sum[n-1] = a[n-1];
    for(int i = n-2; i >= 0; i--) {
        sum[i] = (sum[i+1] + a[i]) % MOD;
    }

    ll res = 0;
    for(int i = 0; i < n-1; i++) {
        res += (a[i] * sum[i+1])%MOD;
        cerr << a[i] << " " << sum[i+1] << endl;
    }

    cout << res % MOD << endl;
    


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

#define MOD 1000000007

int main() {
  int N = 0;
  long long int A[200001] = {0};
  long long int sum = 0,sum2 = 0;

  scanf("%d",&N);
  for(int i=0;i<N;i++) {
    scanf("%I64d",&A[i]);
    sum2 += A[i];
    sum2 %= MOD;
  }

  for(int i=0;i<N;i++){
      sum2 -= A[i];
      if(sum2 < 0) sum2 += MOD;
      sum += (A[i] * sum2);
      sum = sum % MOD;
  }
  printf("%I64d\n",sum);

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

#define MOD_BY 1000000007

int add(int a, int b) {
	return a + b - MOD_BY * (a + b >= MOD_BY);
}

int mul(int a, int b) {
	int r = 0;
	while (b > 0) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int N;
int A[212345];

int morigutihiroko[212345];

int main(void) {
	int i;
	int kotae = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	morigutihiroko[N] = 0;
	for (i = N - 1; i >= 0; i--) {
		morigutihiroko[i] = add(morigutihiroko[i + 1], A[i]);
	}
	for (i = 0; i < N; i++) {
		kotae = add(kotae, mul(A[i], morigutihiroko[i + 1]));
	}
	printf("%d\n", kotae);
	return 0;
}
//  [c]
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PI acos(-1)
typedef unsigned long long int ull;
typedef long double ld;
 
int main(void) {
  int   scan;
 
  ull    answer;
  ull    n;
  ull    *a;
  ull    MOD;
  ull    sums;
  answer = 0;
  MOD = 1000000007;
  sums = 0;
  scan = scanf("%llu", &n);
  a = (ull *)malloc(sizeof(ull) * n);
  for (ull i = 0; i < n; i++) {
    scan = scanf("%llu", &a[i]);
  }
  
  for (ull i = 0; i < n; i++) {
    sums = sums + a[i];
  }
 
  for (ull i = 0; i < n - 1; i++) {
    sums = sums - a[i];
    answer = (answer + a[i] * (sums % MOD)) % MOD;
  }
 
  printf("%llu", answer);
 
  return (0);
}
//  [javascript]
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));

  const sum = arr.reduce((sum, n) => add(sum, n), 0);
  let ans = mul(sum, sum);

  for (let i = 0; i < len; i++) {
    ans -= mul(arr[i], arr[i]);
  }

  console.log(mul(mod(ans), inv(2)));
}
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')
let N = lines[0] - 0
let A = lines[1].split(' ').map(Number)

const mod = 1000000007

const sum = [0]
for (let i = 0; i < N; i++)  {
    sum[i + 1] = (sum[i] + A[i]) % mod
}

function mul (a, b) {
    return ((a >> 16) * b % mod * 65536 + (a & 65535) * b) % mod
}

let ans = 0
for (let i = 1; i < sum.length - 1; i++) {
    ans += mul(sum[i], A[i])
}
console.log(ans % mod)
//  [go]
package main

import (
	"fmt"
)

func main() {
	mod := 1000000007
	var n int
	fmt.Scanf("%d", &n)
	arr := make([]int, n, n)
	b := make([]int, n+1, n+1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &arr[i])
		b[i+1] = b[i] + arr[i]
	}

	var ans int
	for i := 0; i < n-1; i++ {
		sum := (b[n] - b[i+1]) % mod
		ans += arr[i] * sum
		ans %= mod
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
	}
	const p = 1000_000_000 + 7

	sum := 0
	tmp := 0

	for i := N - 2; i >= 0; i-- {

		tmp += A[i+1]
		tmp %= p
		sum += A[i] * tmp
		sum %= p
	}
	//fmt.Println(sum)

	fmt.Println(sum)

}
//  [go]
package main

import "fmt"

func main() {
	var mod int64 = 1000000007
	var n int64
	fmt.Scan(&n)

	a := make([]int64, n)

	for i := range a {
		fmt.Scan(&a[i])
	}

	var data int64
	var ans int64

	for i := n -2; i >= 0; i--{
		data = (data + a[i+1]) % mod
		ans = (ans + (data*a[i])%mod) % mod

	}
	fmt.Println(ans)
}
//  [ruby]
N = gets.strip.to_i
A = gets.split.map(&:strip).map(&:to_i)

m = 10**9+7
x = 0
s = 0
(1..(N-1)).each do |i|
  x += A[i-1]
  y = A[i]
  s = (s + x * y) % m
end

puts s
//  [ruby]
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7
RUI = [0]

A.each do |a|
  RUI << RUI.last + a
end

ans = 0

A[0..-2].each_with_index do |a, idx|
  ans += a * (RUI.last - RUI[idx + 1])
  ans %= MOD
end

puts ans
//  [ruby]
eval"N,*A="+`dd`.split*?,
p (A.sum**2-A.sum{_1*_1}>>1).%10**9+7
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        a: [usize;n],
    }

    let mut sum = 0;
    for i in 1..n {
        sum += a[i];
    }
    debug!(sum);
    let inf = 10_0000_0000 + 7;
    sum %= inf;

    let mut ans = 0;
    for i in 0..n-1 {
        ans += a[i]*sum;
        ans %= inf;
        sum = sum + inf - a[i+1];
        sum %= inf;
        debug!(sum);
        debug!(ans);
    }

    println!("{}", ans);

}
//  [rust]
use proconio::input;
// use proconio::marker::{Bytes, Chars};

fn main() {
    input! {
        n: usize,
        a: [i128; n],
    }

    let mut last = a[0];
    let mut result = 0;

    for i in 1..n {
        result += a[i] * last;
        result = result % (1000000007);
        last += a[i];
    }

    println!("{}", result);
}
//  [swift]
func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainC() {
    let N = readInt()
    let A = readInts()

    var sums: [Int] = []
    sums.append(0)

    for i in 0..<N-1 {
        sums.append((sums.last! + A[N - 1 - i]) % (1000_000_000 + 7))
    }

    var result = 0
    for i in 0..<(N-1) {
        result += A[i] * sums[N - 1 - i]
        result = result % (1000_000_000 + 7)
    }

    print(result % (1000_000_000 + 7))
}
mainC()
//  [swift]
let n = Int(readLine()!)!
let divider = 1000_000_000 + 7
let aArray = readLine()!.split(separator: " ").map{Int($0)!}
var sum = 0
var accumulatedSum = 0
for i in 0..<n-1 {
    let j = n - 1 - i
    accumulatedSum += aArray[j] % divider
    accumulatedSum %= divider
    sum += accumulatedSum * aArray[j-1] % divider
    sum %= divider
}
print(sum)
//  [python]
import math
import calendar
import fractions
import itertools

a, b, c, d = map(int, input().split())

if c < a:
    if d < a:
        print(0)
    elif a <= d <= b:
        print(d - a)
    else:
        print(b - a)
elif a <= c <= b:
    print(min(d - c, b - c))
else:
    print(0)
//  [python]
import numpy as np

A, B, C, D = map(int, input().split())
x = sorted(zip([A, B, C, D], [1, -1, 1, -1]))
if x[1][1] == 1:
  print(x[2][0] - x[1][0])
else:
  print(0)
//  [java]
import java.util.*;
class Main{
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int[]a=new int[114];
		++a[getInt()];
		--a[getInt()];
		++a[getInt()];
		--a[getInt()];
		Arrays.parallelPrefix(a,Integer::sum);
		System.out.println(Arrays.stream(a).filter(i->i==2).count());
	}
}
//  [java]
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		IntStream alices = IntStream.range(sc.nextInt(), sc.nextInt());
		List<Integer> bobs = IntStream.range(sc.nextInt(), sc.nextInt()).boxed().collect(Collectors.toList());
		sc.close();
		Long count = alices.filter(alice -> bobs.contains(alice)).count();
		System.out.println(count);
	}
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;
 
public class Main{
    static IntStream REPS(int v){return IntStream.range(0,v);}
    static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
    static IntStream INS(int n) {return REPS(n).map(i->getInt());}
    static Scanner s=new Scanner(System.in);
    static int getInt(){return Integer.parseInt(s.next());}
    public static void main(String[]$){
        int[]a=new int[114];
        ++a[getInt()];
        --a[getInt()];
        ++a[getInt()];
        --a[getInt()];
        Arrays.parallelPrefix(a,Integer::sum);
        System.out.println(Arrays.stream(a).filter(i->i==2).count());
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << max((int)0, min(B, D) - max(A, C)) << endl;
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
  int a,b,c,d,time;
  cin >>a>>b>>c>>d;
  if(a>=d||b<=c){
    time=0;
  }else if(a<=c){
    time=min(b-c,d-c);
  }else{
    time=min(b-a,d-a);
  }
  cout << time << endl;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    vector<int> a(2), b(2);
    vector<int> r(1e7 + 1, 0);
    for(int  i= 0; i < 2; ++i){
        cin >> a[i] >> b[i];
        ++r[a[i]];
        --r[b[i]];
    }
    int c = 0;
    for(int i = 0; i < 1e7; ++i){
        c += (r[i] == 2);
        r[i + 1] += r[i];
    }
    cout << c << endl;
}
//  [c]
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int A, B, C, D;
    int i;
    int a[101] = {0};
    int b[101] = {0};
    int c[100] = { 0 };
    int time = 0;

    scanf("%d %d %d %d", &A, &B, &C, &D);

    for (i = A; i <= B; i++) {
        a[i] = 1;
    }

    for (i = C; i <= D; i++) {
        b[i] = 1;
    }

    for (i = 0; i <= 100; i++) {
        c[i] = a[i] + b[i];
        if (c[i] == 2)
            time++;
    }

 
    if (time == 0)
        printf("%d", time);
    else
    printf("%d", time-1);

    return 0;
}
//  [c]
#include<stdio.h>
int main ()
{
    int a,b,c,d,x,y;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a>c) x=a;
    else x=c;
    if(b>d) y=d;
    else y=b;
    if(x>y) printf("0");
    else printf("%d",y-x);
    return 0;



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

int main()
{
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);
	A = (A < C)? C: A;
	B = (B < D)? B: D;
	printf("%d\n", (A < B)? B - A: 0);
	fflush(stdout);
	return 0;
}