jiahuimbzuai/CoQuIR huggingface dataset:
//  [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 {
            "Heisei"
        } else if y > 2019 {
            "TBD"
        } else if m > 5 {
            "TBD"
        } else {
            "Heisei"
        }
    } else {
        ""
    };
    println!("{}", ans);
}
//  [rust]
import datetime


def main():
    s = datetime.datetime.strptime(input(), "%Y/%m/%d")
    if s <= datetime.datetime(2019,4,30):
        print("Heisei")
    else:
        print("TBD")


if __name__ == '__main__':
    main()
//  [rust]
#![allow(non_snake_case)]

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)*}
    };
}

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")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}


macro_rules! test {
    ($(($testid:expr, $input:expr) => ($expected_output:expr)),* $(,)*) => {
        $(
            paste::item! {
                #[test]
                fn [<solve_test_ $testid>]() {
                    println!("[in]\n{}", $input);
                    println!("[out]\n{}", solve($input));
                    println!("[expected out]\n{}", $expected_output);
                    assert_eq!(solve($input), $expected_output);
                }
            }
         )*
    }
}

test! {
    (1, "2019/04/30") => ("Heisei"),
    (2, "2019/11/01") => ("TBD")
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        S: String
    }

    let mut ans = "Heisei";
    if S.as_str() > "2019/04/30" {
        ans = "TBD"
    }

    return ans.to_string();
}
//  [swift]
import Foundation;print(Int(readLine()!.componentsSeparatedByString("/")[1])!<=4 ?"Heisei":"TBD")
//  [swift]
import Foundation;Int(readLine()!.componentsSeparatedByString("/")[1])!<=4 ?print("Heisei"):print("TBD")
//  [swift]
extension String:CollectionType{};print(Int(readLine()!.split("/")[1])!<=4 ?"Heisei":"TBD")
//  [swift]
import Foundation; Int(readLine()!.characters.split("/")[1])!<=4 ? print("Heisei") : print("TBD")
//  [swift]
import Foundation
var r = ""
Int(readLine()!.componentsSeparatedByString("/")[1])!<=4 ? r="Heisei" : r="TBD"
print(r)
//  [swift]
import Foundation

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

if month <= 4 {
    print("Heisei")
} else {
  	print("TBD")
}
//  [typescript]
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const inputList = input.split('/'); // 空白文字に注意
// const inputNumberList = inputList.map(Number);

// const input = require('fs').readFileSync('/dev/stdin', 'utf8');
// const inputList = input.split('\n');
// const inputNumberList = inputList.map(Number);

const month_str = inputList[1];
let month;

if (month_str[0] === '0') {
  month = Number(month_str[1]);
} else {
  month = Number(month_str);
}

if (month > 4) {
  console.log('TBD');
} else {
  console.log('Heisei');
}
//  [typescript]
((input: string): void => {
    const s: number = Number(input.split("/").join(""));
    console.log(s <= 20190430 ? 'Heisei' : 'TBD');
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import * as fs from 'fs';

//in
// 2019/04/30
//out
// Heisei
const main = (inp: string) => {
    if (inp <= '2019/04/30') {
        console.log('Heisei');
    } else {
        console.log('TBD');
    }
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const S = stdin.split('\n')[0]

const [y,m,d] = S.split('/').map(Number)

let res = ''

console.log(y,m,d)

if(m > 4){
  res = 'TBD'
} else if(m === 4 && d === 31){
  res = 'TBD'
} else {
  res = 'Heisei'
}

console.log(res)
//  [typescript]
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const S = stdin.split('\n')[0]

const [y,m,d] = S.split('/').map(Number)

let res = ''

if(m > 5){
  res = 'TBD'
} else if(m === 4 && d === 31){
  res = 'TBD'
} else {
  res = 'Heisei'
}

console.log(res)
//  [typescript]
function solve(Y,M,D):boolean{
    if(Y<2019)return true;
    if(Y>2019)return false;
    if(M<4)return true;
    if(M>4)return false;
    return D<=30
}
function Main(raw) {
    const input = raw.split("\n");
    const S = input[0].split("/");
    const Y= parseInt(S[0],10)
    const M= parseInt(S[1],10)
    const D= parseInt(S[2],10)
    
    //出力
    console.log("%d", solve(Y,M,D)?'Heisei':'TBD');
  }
  
  //DO NOT EDIT
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
import math
X = int(input())
a1 = math.ceil(X**(1/5))
N = int(1e10)
c = 0
b = 0
while c <= N:
    if b**5 < -X:
        b2 = b + 1
        break
    b -= 1
c = 0
while c <= N:
    c += 1
    b1 = math.floor((a1**5-X)**(1/5))
    a2 = math.floor((X+b2**5)**(1/5))
    if a1**5 - b1**5 == X:
        print(a1, b1)
        break
    elif a2**5 - b2**5 == X:
        print(a2, b2)
        break
    a1 += 1
    b2 += 1
//  [python]
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X = int(input())

    if X == 1:
        print(1, 0)
        return

    ii = 2 if X % 2 else 1

    N = 10**9

    for x in range(1, N, ii):
        if X % x:
            continue
        for i in range(N):
            j = i - x

            ij = i**5 - j**5
            diff = ij - X
            if diff == 0:
                print(i, j)
                return
            elif j > 0 and diff > 0:
                break




if __name__ == "__main__":
    resolve()
//  [python]
import math
x = int(input())
i = 0
while True:
  if (i**5 <= x):
    s = (x-i**5)**0.2
    s = math.floor(s*(10**7))/(10**7)
  t = (x+i**5)**0.2
  t = math.floor(t*(10**7))/(10**7)
  if s.is_integer() and i**5 <= x:
    print(int(s),-i)
    break
  elif t.is_integer():
    print(int(t), i)
    break
  i += 1
//  [python]
x=int(input())
for i in range(40):
  for j in range(-40,40):
    if i**5-j**5==x:
      print(i,j)
      exit()
//  [python]
x=int(input())
for i in range(-118,120):
  for j in range(-119,1119):
    if i**5+j**5==x:
      print(i,j)
      exit()
//  [python]
x=int(input())
y=0
while True:
  z=x+y**5
  if z**(1/5)==int(z**(1/5)):
    print(int(z**(1/5)), y)
    exit()
  w=x-y**5
  if w**(1/5)==int(w**(1/5)):
    print(int(w**(1/5)), -y)
    exit()
  y+=1
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    long X = sc.nextInt();
    String ans = "";

    long t[] = new long[200];
    for (int i = 0; i < 200; i++) {
      t[i] = (long) Math.pow(i, 5);
    }
    for (int i = 0; i < 200; i++) {
      for (int j = 0; j < 200; j++) {
        if (t[i] - t[j] == X) {
          ans = i + " " + j;
          break;
        }
        if (t[i] + t[j] == X) {
          ans = i + " " + j * -1;
          break;
        }
        if (!ans.equals("")) {
          break;
        }
      }
    }

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        if(x == 1) {
            System.out.println("0 -1");
            return;
        }
        long xx = (long) Math.ceil(Math.sqrt(Math.cbrt(x)));
        for (long i = 1; i <= xx; i--) {
            for (long j = -1; j < xx; j--) {
                long a = (long) Math.pow(i, 5);
                long b = (long) Math.pow(j, 5);
                if(a - b == x) {
                    System.out.println(i + " " + j);
                    return;
                }
            }
        }
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        if(x == 1) {
            System.out.println("0 -1");
            return;
        }
        long xx = (long) Math.ceil(Math.sqrt(Math.cbrt(x)));
        for (long i = xx; i > 0; i--) {
            for (long j = -1; j < xx; j--) {
                long a = (long) Math.pow(i, 5);
                long b = (long) Math.pow(j, 5);
                if(a - b == x) {
                    System.out.println(i + " " + j);
                    return;
                }
            }
        }
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        if(x == 1) {
            System.out.println("0 -1");
            return;
        }
        long xx = (long) Math.sqrt(Math.sqrt(x));
        for (long i = xx; i > 0; i--) {
            for (long j = -1; j < xx; j--) {
                long a = (long) Math.pow(i, 5);
                long b = (long) Math.pow(j, 5);
                if(a - b == x) {
                    System.out.println(i + " " + j);
                    return;
                }
            }
        }
    }
}
//  [cpp]
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-9;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
long long p[110000];
int main(){
	int a;scanf("%d",&a);
	int sz=0;
	for(int i=-200;i<=200;i++){
		p[sz++]=(long long)i*i*i*i*i;
	}
	for(int i=0;i<sz;i++)for(int j=0;j<sz;j++){
		if(p[i]-p[j]==a){
			printf("%d %d\n",i-200,j-200);return 0;
		}
	}
}
//  [cpp]
#include <stdio.h>
typedef long long ll;

ll mpow(ll a) {
  return a * a * a * a * a;
}

int main(void) {
  ll i, j, x;
  scanf("%lld", &x);
  for(i = -200; i < 201; ++i) for(j = -200; j < 201; ++j) if(mpow(i) - mpow(j) == x) {
    printf("%lld %lld", i, j);
    return 0;
  }
  return 0;
}
//  [cpp]
#include <cctype>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define pk putchar(' ')
#define ph puts("")
typedef long long ll;
using namespace std;
template <class T>
void rd(T &x)
{
    x = 0;
    int f = 1;
    char c = getchar();
    while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
    while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
    x *= f;
}
template <class T>
void pt(T x)
{
    if (x < 0)
        putchar('-'), x = (~x) + 1;
    if (x > 9)
        pt(x / 10);
    putchar(x % 10 ^ 48);
}
int n;
int main() 
{
	rd(n);
	for (int i = 0; ; i++)
		for (int j = -1280; j <= 1280; j++)
			if (i * i * i * i * i - j * j * j * j * j == n)
				return !printf("%d %d\n", i, j);
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
   int x,c=0,p,q;
   long int i,j;
   cin>>x;
   for(i=0;i<=sqrt(x);i++)
   {
       for(j=-sqrt(x);j<=sqrt(x);j++)
       {
           if(pow(i,5)-pow(j,5)==x)
           {
               c=1;
                p=i;
               q=j;
               break;
           }
       }
   }
   if(c==1)
    cout<<p<<" "<<q<<endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
   long long int i,j;
   int x,c=0,p,q;
   cin>>x;
   for(i=0;i<=sqrt(x);i++)
   {
       for(j=-sqrt(x);j<=sqrt(x);j++)
       {
           if(pow(i,5)-pow(j,5)==x)
           {
               c=1;
                p=i;
               q=j;
               break;
           }
       }
   }
   if(c==1)
    cout<<p<<" "<<q<<endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
   long long int x,i,j,c=0,p,q,r;
   cin>>x;
   r=sqrt(x);
   for(i=0;i<=r;i++)
   {
       for(j=-r;j<=r;j++)
       {
           if(pow(i,5)-pow(j,5)==x)
           {
               c=1;
               p=i;
               q=j;
               break;
           }
       }
   }
   if(c==1)
    cout<<p<<" "<<q<<endl;
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

// 1000**5 - 999**5 = 4.99001e+12
#define NUM_MAX 1000

struct pair {
    int a;
    int b;
};

int main(void) {
    int64_t target = get_int();
    int a, b;
    struct pair ans = {0, 0};
    for(a = 0; a <= NUM_MAX; a++) {
        for(b = 0; b <= NUM_MAX; b++) {
            int64_t a5 = (int64_t)a*a*a*a*a;
            int64_t b5 = (int64_t)b*b*b*b*b;
            if(a5+b5 == target) {
                ans = (struct pair){a, -b};
                goto finish;
            }
            if(a5-b5==target) {
                ans = (struct pair){a, b};
                goto finish;
            }
        }
    }
finish:
    printf("%d %d\n", ans.a, ans.b);
    return 0;
}
//  [c]
int main(void)
{
  long x;
  scanf("%ld",&x);
  long long i, j;
  for (i = -120; i < 121; i++)
  {
    for (long long j = -120;j < 121;j++)
    {
      if(i * i * i * i * i - j * j * j * j * j == x)
      {
        printf("%lld %lld",i,j);
        return 0;
      }
    }
  }
}
//  [c]
#include<stdio.h>
int main()
{
    int x;
    scanf("%d",&x);
    for(int i=-120;i<=120;i++)
    {
        for(int j=-120;j<=120;j++)
        {
            if(i*i*i*i*i-j*j*j*j*j==x)
            {
                printf("%d %d\n",i,j);
                return 0;
            }
        }
    }
}
//  [c]
#include<stdio.h>
#include<math.h>
int main()
{
long int x,i,j,a,b,sw;
  scanf("%ld",&x);
  sw=0;
  a=-100;
  while(sw==0)
  {
  b=100;
   for(i=-b;i<b;++i)
   {if(pow(a,5)-pow(i,5)==x) {sw++;
                              b=i;
                             }
   }
    a++;
  }

  printf("%ld %ld",a,b);

return 0;}
//  [c]
#include <stdio.h>
#include <math.h>
int main(void){
  long long a,b,n,k,i;
  scanf("%lld %lld %lld",&a,&b,&n);
  k= floor((long double)a*n/b);
  if(b==1){
    printf("0");
    } else if(n<b) {
      printf("%lld",k);
    }else{
    k= floor((long double)a*(b-1)/b)-floor((long double)(b-1)/b);
          printf("%lld",k);
  }


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

int main(void){
  long long x,a=0,b;
  scanf("%lld",&x);
  b=0;
     while(a==0){
    if (ceil((double) pow(x+pow(b,5),(double)1.0/5.0))==floor((double) pow(x+pow(b,5),(double)1.0/5.0))){
      a=(double) pow(x+pow(b,5),(double)1.0/5.0);
      break;
    }
    if(b==0){
      b++;
    }else if(b>0){
      b=b-2*fabs(b);
        }else{
      b=b+2*fabs(b)+1;
    }
    }
   printf("%lld %lld",a,b);

  return 0;
}
//  [javascript]
"use strict";

// read lines from stdin
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const X = parseInt(input[0]);

let i = 0;
const resultStockList = [];

while (true) {
  const result = Math.pow(i, 5);
  resultStockList.push(result);

  for (let j = 0; j < resultStockList.length; j++) {
    if (
      result - resultStockList[j] === X ||
      resultStockList[j] - result === X
    ) {
      console.log(`${i} ${j}`);
      return;
    }

    if (result + resultStockList[j] === X) {
      console.log(`${i} ${-j}`);
      return;
    }
  }

  i++;
}
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const x = parseInt(input[0]);
    for(let a = -120; a<= 120; a++){
        for(let b = -120; b<= 120; b++){
            let tmp = a*a*a*a*a - b*b*b*b*b
            if(x === tmp){
                console.log(`${a} ${b}`)
                return
            }
        } 
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function D166(_input) {
    var lines = _input.split("\n");
    var x = lines.shift()*1;

    for (var i = 119; i > -118; i--) {
        for (var j = 118; j > -119; j--) {
            const fi = i*i*i*i*i;
            const fj = j*j*j*j*j;
            if (fi - fj === x) {
                console.log(`${i} ${j}`);
                return;
            }
        }
    }
}
D166(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = (input) => {
  const s = Number(input.trim())

  for (let x=0; x<=100; x++) {
    for (let y=-100; y<=99; y++) {
      if (x**5 - y**5 === s) return console.log(`${x} ${y}`)
    }
  }
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
const main = (input) => {
  const s = BigInt(input.trim())

  for (let x=0n; x<100n; x++) {
    for (let y=0n; y<100n; y++) {
      if (x**5n - y**5n === s) {
        return console.log(`${x} ${y}`)
      } else if (x**5n + y**5n === s) {
        return console.log(`${x} -${y}`)
      }
    }
  }
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
const main = (input) => {
  const s = BigInt(input.trim())

  for (let x=0n; x<100n; x++) {
    for (let y=0n; y<100n; y++) {
      if (x**5n - y**5n === s) {
        return console.log(`${x} ${y}`)
      } else if (x**5n + y**5n === s) {
        return console.log(`${x} ${-y}`)
      }
    }
  }
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [go]
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 100000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

func scanIntNum() (num int) {
	sc.Scan()

	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return num
}

func main() {
	input := scanIntNum()
	bminf := root(float64(input), 5)
	bmin := -1 * int(math.Floor(bminf))
	var a float64

	for i := bmin; ; i++ {
		a5 := input + int(math.Pow(float64(i), 5))
		if a5 == 0 {
			a = 0
		} else {
			a = root(float64(a5), 5)
		}
		if a-math.Floor(a) == 0.0 {
			fmt.Println(int(math.Floor(a)), i)
			return
		}
	}
}

func root(a float64, n int) float64 {
	n1 := n - 1
	n1f, rn := float64(n1), 1/float64(n)
	x, x0 := 1., 0.
	for {
		potx, t2 := 1/x, a
		for b := n1; b > 0; b >>= 1 {
			if b&1 == 1 {
				t2 *= potx
			}
			potx *= potx
		}
		x0, x = x, rn*(n1f*x+t2)
		if math.Abs(x-x0)*1e15 < x {
			break
		}
	}
	return x
}
//  [go]
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	X := nextInt()
	var n int
	// 一応、値決め打ちでなくてちゃんと計算させた場合
	for i := 0; i*i*i*i*i-(i-1)*(i-1)*(i-1)*(i-1)*(i-1) < 1e9; i++ {
		n = i + 1
	}
	for i := 0; i <= n; i++ {
		for j := 0; j <= i; j++ {
			if i*i*i*i*i-j*j*j*j*j == X {
				fmt.Println(i, j)
				return
			} else if i*i*i*i*i+j*j*j*j*j == X {
				fmt.Println(i, -j)
			}
		}
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
//  [go]
package main

import (
	"fmt"
)

func pow(n int) int64 {
	m := int64(n)
	return m * m * m * m * m
}

func f(a, b int) int64 {
	return pow(a) - pow(b)
}

func main() {
	var x int64
	fmt.Scan(&x)

	var maxInd int
	for maxInd = 1; f(maxInd, maxInd-1) <= x; maxInd++ {
	}
	for a := -maxInd; a < maxInd; a++ {
		for b := -maxInd; b < maxInd; b++ {
			if f(a, b) == x {
				fmt.Println(a, b)
				return
			}
		}
	}
}
//  [go]
package main

import "fmt"

func main() {
	// Code for D - I hate Factorization
	var X int
	fmt.Scan(&X)

	for A := -100; A <= 100; A++ {
		for B := -100; B <= 100; B++ {
			//fmt.Println((A*A*A*A*A)-(B*B*B*B*B), A, B)
			if (A*A*A*A*A)-(B*B*B*B*B) == X {
				fmt.Println(A, B)
				return
			}
		}
	}
}
//  [go]
package main

import "fmt"

func main() {
	// Code for D - I hate Factorization
	var X int

	for A := -100; A <= 100; A++ {
		for B := -100; B <= 100; B++ {
			if (A*A*A*A*A)-(B*B*B*B*B) == X {
				fmt.Println(A, B)
				break
			}
		}
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	x := nextInt()

	for i := -100; i < 100; i++ {
		i5 := i * i * i * i * i
		for j := -100; j < 100; j++ {
			j5 := j * j * j * j * j
			if i5-j5 == x {
				fmt.Println(i, j)
				return
			}
		}
	}

	fmt.Println("DBG") //! DBG
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [ruby]
H = {}
120.times {|i| H[n=i**5] = i; H[-n] = -i}
X = gets.to_i
F =->(b,y) { a=H[X+y] and puts([a,b]*' ') || exit }
120.times {|b| y = b**5; F[b,y]; F[-b,-y]}
//  [ruby]
X = gets.chomp.to_i

def calc_b(a)
  b5 = (a**5 - X)
  if b5 >= 0
    b5.pow(1.0/5).to_i
  else
    (-b5).pow(1.0/5).to_i * -1
  end
end

def val(a, b)
  a**5 - b**5
end

a = 1
b = calc_b(a)

until (v = val(a, b)) == X
  a += 1
  b = calc_b(a)
end

puts [a, b].join(" ")
//  [ruby]
X = gets.to_i
sq = []
prev = 0
0.upto(100000) do |i|
  d = i*i*i*i*i
  sq << d
  break if d - prev > 1000000000
  prev = d
end

sq2 = sq.dup
sq.each do |a|
    sq2.shift
    sq2.each do |b|
        if a - b == X
            puts "#{sq.index(a)} #{sq.index(b)}"
            exit
        elsif (-a) - b == X
            puts "-#{sq.index(a)} #{sq.index(b)}"
            exit
        elsif a + b == X
            puts "#{sq.index(a)} -#{sq.index(b)}"
            exit
        elsif (-a) + b == X
            puts "-#{sq.index(a)} -#{sq.index(b)}"
            exit
        end
    end
end
//  [ruby]
x = gets.to_i

(-120..120).each do |i|
  (-120..120).each do |j|
    if (i ** 5 - j ** j) == x
      puts "#{i} #{j}" 
      return
    end
  end
end
//  [ruby]
x = gets.to_i

(-120..120).each do |i|
  (-120..120).each do |j|
    if i ** 5 - j ** j == x
      puts "#{i} #{j}" 
      return
    end
  end
end
//  [ruby]
x = gets.to_i

require "prime"

def divisors(n)
  n.prime_division.inject([1]) do |ary, (p, e)|
    (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
  end.sort
end

divisors(x).each do |num|
  d = x / num
  a = 0
  b = -num
  line = a ** 4
  m = a ** 4 + (a ** 3) * b + (a ** 2) * (b ** 2) + a * (b ** 3) + b ** 4

  while line < x
    if m == d
      puts "#{a} #{b}"
      return
    end
    
    a += 1
    b += 1
    line = a ** 5
    m = a ** 4 + (a ** 3) * b + (a ** 2) * (b ** 2) + a * (b ** 3) + b ** 4
  end
end
//  [rust]
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        x: isize,
    }
    for i in -120..120_isize {
        for j in -120..120_isize {
            if i.pow(5) - j.pow(5) == x {
                println!("{} {}", i, j);
                return;
            }
        }
    }
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: i64
    }

    let max = {
        let mut max:i64 = 1;
        let mut k = 1;
        while k < n {
            k = (max+1).pow(5) - max.pow(5);
            max += 1;
        }
        max
    };
    
    let mut a: i64 = 0;
    let mut b: i64 = 0;
    let mut flag = false;
    for i in -max..=max {
        for j in -max..=max {
            if n == i.pow(5) - j.pow(5) {
                a = i as i64;
                b = j as i64;
                flag = true;
                break;
            }
        if flag {
            break;
        }
        }
    }

    println!("{} {}",a,b)
}
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        x: i64,
    }

    let pow5: Vec<i64> = (0i64..120).map(|x| x.pow(5)).collect();
    for (a, a5) in pow5.iter().enumerate() {
        for (b, b5) in pow5.iter().enumerate() {
            if a5 - b5 == x {
                println!("{} {}", a, b);
                return;
            }
            if a5 + b5 == x {
                println!("{} -{}", a, b);
                return;
            }
        }
    }
}
//  [rust]
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        x: u64,
    }
    println!("{} -1", ((x - 1) as f64).powf(1.0/5.0));
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {x: usize};
    let x: usize = x;
    let mut t = false;

    for a in 0..((x as f64).sqrt() as usize) * 2 {
        for b in 0..(x as f64).sqrt() as usize * 2 {
            if a.pow(5) + (b * b * b * b * b) == x || a.pow(5) - (b * b * b * b * b) == x {
                if b == 0 {
                    println!("{} {}", a, b);
                } else {
                    println!("{} -{}", a, b);
                }
                t = true;
            }
            if t {
                break;
            }
        }
        if t {
            break;
        }
    }
}
//  [swift]
import Foundation

let X = Int(readLine()!)!

func powFive(_ x: Int) -> Int {
    return x * x * x * x * x
}

outer: for A in -200...200 {
    for B in -200...200 {
        if powFive(A) - powFive(B) == X {
            print(A, B)
            break outer
        }
    }
}
//  [swift]
let x = Int(readLine()!)!

let nums = Array(-999...999).map { n -> (Int, Int) in
    var r = 1
    for _ in 0..<5 {
        r *= n
    }
    return (n, r)
}

root: for a in nums {
    for b in nums {
        if a.1 - b.1 == x {
            print("\(a.0) \(b.0)")
            break root
        }
    }
}
//  [swift]
func main() {
    let x = Int(readLine()!)!
    for i in 1...100 {
        for j in -100..<i {
            let result = i * i * i * i * i - j * j * j * j * j
            if result == x {
                print("\(i) \(j)")
                return
            }
        }
    }
}

main()
//  [swift]
func readInt() -> Int {
    return Int(readLine()!)!
}

func mainD() {
    let X = readInt()

    let n = 100

    for i in -n...n {
        for j in -n...n {
            let A = i * i * i * i * i
            let B = j * j * j * j * j

            if (A - B) == X {
                print(i, j)
                return
            }
        }
    }
}
mainD()
//  [swift]
// 全探索したい 
// A,B が取りうる上限を見つける

for i in (1...1000) {
    let a = i
    let b = i-1
    if a^^5 - b^^5 > 10^^9 {
        debugPrint(i) // 120
        break
    }
}

// 120までA，Bを全探索すれば良さそうということがわかった。

// 本題

let x = cin.int
Array(-120...120).forEach { a in 
    Array(-120...120).forEach { b in
        if a^^5 - b^^5 == x {
            print("\(a) \(b)")
            exit(0)
        }
    }
}

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

precedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }
infix operator ^^ : PowerPrecedence
func ^^ (radix: Int, power: Int) -> Int {
    return Int(pow(Double(radix), Double(power)))
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const x = Number(lines[0]);

  let a = 119;
  // let a = 10;

  while (true) {
    let b = a - x;
    b < -119 ? (b = -119) : "";
    for (let i = b; i < a; i++) {
      const sa = a - i;
      if (x % sa === 0) {
        const a5 = a * a * a * a * a;
        const b5 = i * i * i * i * i;
        if (a5 - b5 === x) {
          console.log(`${a} ${i}`);
          return;
        }
      }
    }
    a--;
  }
});
//  [typescript]
class NormalInput {
  input: string[];
  pointer: number;
  constructor(raw: string) {
    this.input = raw.split(/ |\n/);
    this.pointer = 0;
  }
  read<T>(parser: (v: string) => T): () => T {
    return () => {
      const ret = parser(this.input[this.pointer]);
      this.pointer++;
      return ret;
    };
  }
  int = this.read((str) => parseInt(str, 10));
  ints = (length: number): number[] => {
    let ret: number[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.int());
    }
    return ret;
  };
  str = (): string => {
    const ret = this.input[this.pointer];
    this.pointer++;
    return ret;
  };
  strs = (length: number): string[] => {
    let ret: string[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.str());
    }
    return ret;
  };
  bint = (): bigint => {
    const ret = BigInt(this.input[this.pointer]);
    this.pointer++;
    return ret;
  };
  bints = (length: number): bigint[] => {
    let ret: bigint[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.bint());
    }
    return ret;
  };
}
function rep(a: number, b: number) {
  let arr = [];
  for (let i = a; i < b; i++) arr.push(i);
  return arr;
}

function Main({ int, str, strs, ints, bint }: NormalInput) {
  const X = bint();
  for (let a = BigInt(-120); a < 120; a++)
    for (let b = BigInt(-120); b < 120; b++) {
      if (X === a * a * a * a * a - b * b * b * b * b) {
        console.log(""+a, ""+b);
        return;
      }
    }
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [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; 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);
}
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const x = Number(lines[0]);

  let a = 119;
  // let a = 10;

  while (true) {
    let b = a - x;
    b < -119 ? (b = -119) : "";
    for (let i = b; i < a; i++) {
      const sa = a - i;
      console.log(a, i);
      if (x % sa === 0) {
        const a5 = a * a * a * a * a;
        const b5 = i * i * i * i * i;
        if (a5 - b5 === x) {
          console.log(`${a} ${i}`);
          return;
        }
      }
    }
    a--;
  }
});
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const x = Number(lines[0]);

  let a = 119;
  // let a = 10;
  let b = a - x;

  while (true) {
    let b = a - x;
    for (let i = b; i < a; i++) {
      const sa = a - i;
      if (x % sa === 0) {
        const a5 = a * a * a * a * a;
        const b5 = i * i * i * i * i;
        if (a5 - b5 === x) {
          console.log(`${a} ${i}`);
          return;
        }
      }
    }
    a--;
  }
});
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const x = Number(lines[0]);

  let a = 100;
  // let a = 10;
  let b = a - x;

  while (true) {
    let b = a - x;
    for (let i = b; i < a; i++) {
      const sa = a - i;
      if (x % sa === 0) {
        const a5 = a * a * a * a * a;
        const b5 = i * i * i * i * i;
        if (a5 - b5 === x) {
          console.log(`${a} ${i}`);
          return;
        }
      }
    }
    a--;
  }
});
//  [python]
mod = 10 ** 9 + 7

N, *A = map(int, open(0).read().split())

S1 = sum(A)
S2 = sum(a * a for a in A)

print((S1 ** 2 - S2) // 2 % mod)
//  [python]
n = int(input())

a = list(map(int, input().split()))

S = sum(a)

S2 = sum(map(lambda x: x * x, a ))

ans = (S * S - S2) // 2 % 1000000007
print(ans)
//  [python]
def main(N, A):
    ans = 0
    for i in range(N-1):
        ans += A[i]*sum(A[i+1:])
        ans %= 10**9 + 7
        """
        for j in range(i+1, N):
            ans += A[i]*A[j]
            ans = ans % (10**9 + 7)
        """
    return ans

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = main(N, A)
    print(ans)
//  [python]
import numpy
def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    N = 10**9+7
    cumsum_a = numpy.cumsum(a[::-1])
    ans = 0
    for i in range(n-1):
        ans += a[i]*cumsum_a[n-i-2]
        ans %= N
    print(ans)
resolve()
//  [python]
def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    N = 10**9+7
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            ans += a[i]*a[j]
            ans %= N
    print(ans)
resolve()
//  [java]
import java.util.*;
public class Main {
    public static long mod(long x, long y){
    return x%y<0?x%y+(y<0?-y:y):x%y;
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long b = 1000000007;
        long sum = 0;
        long mul = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                             sum+=in[i];
                             mul+=in[i]*in[i];
                             sum=mod(sum,b);
                             mul=mod(mul,b);
                            }       
        long ans = mod(sum*sum-mul,b);
        if(ans%2==1){ans=mod(ans+b,b);}
        ans/=2;
		System.out.println(ans);
	}
}
//  [java]
import java.util.*;
public class Main {
    public static long mod(long x, long y){
    return x%y<0?x%y+(y<0?-y:y):x%y;
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long b = 1000000007;
        long sum = 0;
        long mul = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                             sum+=in[i];
                             mul+=in[i]*in[i];
                             sum=mod(sum,b);
                             mul=mod(mul,b);
                            }       
        long ans = mod(sum-mul,b);
        if(ans%2==1){ans=mod(ans+b,b);}
        ans/=2;
		System.out.println(ans);
	}
}
//  [java]
import java.util.*;
public class Main {
    public static long mod(long x, long y){
    return x%y<0?x%y+(y<0?-y:y):x%y;
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long b = 1000000007;
        long sum = 0;
        long mul = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                             sum+=in[i];
                             mul+=in[i]*in[i];
                             sum=mod(sum,b);
                             mul=mod(mul,b);
                            }       
        long ans = mod(sum-mul,mod);
        if(ans%2==1){ans=mod(ans+b,mod);}
		System.out.println(ans);
	}
}
//  [cpp]
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}
const int mod = 1e9 + 7;
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint();
	ll kei = 0;
	ll kei2 = 0;
	ll kei3 = 0;
	const ll ma = (1ll << 60) - 1;
	rep(i, N) {
		ll a = getint();
		kei += a;
		kei2 += a * a;
		kei3 += kei2 >> 60;
		kei2 &= ma;
	}
	kei %= mod;
	kei = kei * kei % mod;

	kei2 = kei2 % mod;
	kei3 %= mod;
	kei3 = kei3 * ((1ll << 60) % mod) % mod;
	kei = (kei - kei2 - kei3 + mod + mod) % mod;

	kei = kei * (mod / 2 + 1) % mod;

	printf("%d\n", kei);


	Would you please return 0;
}
//  [cpp]
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}
const int mod = 1e9 + 7;
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint();
	int A[200000];
	ll kei = 0;
	__int128 kei2 = 0;
	rep(i, N) {
		kei += (A[i] = getint());
		kei2 += (ll)A[i] * A[i];
	}
	kei %= mod;
	kei = kei * kei % mod;

	int kari = kei2 % mod;
	kei = (kei - kari + mod) % mod;

	kei = kei * (mod / 2 + 1) % mod;

	printf("%d\n", kei);


	Would you please return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define m 1000000007

int main(){
    ll sum=0, n=0, ans=0;
    int i=0, j=0;

    cin >> n;

    ll arr[n];

    for(i=0; i<n; i++){
        cin >> arr[i];
        sum += arr[i]%m;
        sum %= m;
    }

    for(i=0; i<n-1; i++){
        sum -= (arr[i]%m);
        ans += ((sum%m)*(arr[i]%m))%m;
        ans %= m;
    }

    cout << ans << endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define m 1000000007

int main(){
    ll sum=0, n=0, ans=0;
    int i=0, j=0;

    cin >> n;

    ll arr[n];

    for(i=0; i<n; i++){
        cin >> arr[i];
        sum += arr[i]%m;
    }
    sum %= m;

    for(i=0; i<n-1; i++){
        sum -= (arr[i]%m);
        ans += ((sum%m)*(arr[i]%m))%m;
    }
    ans %= m;

    cout << ans << endl;
    return 0;
}