#include <cstdio>
#include <cmath>
#include <limits>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdint>
#include <functional>
#include <sstream>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using ss = stringstream;

const ll mod = 1000000000 + 7; //10^9
const ll llmax = pow(10, 18);

// bool is_integer(double x){
//     return floor(x) == x;
// }

// struct factorial
// {
//     vector<ll> fac, finv, inv;

//     factorial(int n) : fac(2, 1), finv(2, 1), inv(2, 1)
//     {
//         int i;

//         rep(i, 2, n + 1)
//         {
//             fac.push_back(fac[i - 1] * i % mod);
//             inv.push_back(mod - inv[mod % i] * (mod / i) % mod);
//             finv.push_back(finv[i - 1] * inv[i] % mod);
//         }
//     }

//     ll comb(int n, int k)
//     {
//         if (n < k)
//         {
//             return 0;
//         }

//         if (n < 0 || k < 0)
//         {
//             return 0;
//         }

//         return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
//     }

//     ll perm(int n, int k)
//     {
//         if (n < k)
//         {
//             return 0;
//         }

//         if (n < 0 || k < 0)
//         {
//             return 0;
//         }

//         return fac[n] * finv[n - k] % mod;
//     }
// };
// ll power(ll x, ll y)
// {
//     ll ans = 1;
//     while (y)
//     {
//         if (y & 1)
//             ans = (ans * x) % mod;
//         x = (x * x) % mod;
//         y >>= 1;
//     }
//     return ans;
// }

// ll mod_conb(ll n, ll k)
// {
//     ll ans = 1;

//     if (n < k || n < 0 || k < 0)
//     {
//         return 0;
//     }

//     for (long long i = 0; i < k; i++)
//     {
//         ans *= n - i;
//         ans %= mod;
//         ans *= power(i + 1, mod - 2);
//         ans %= mod;
//     }

//     return ans;
// }
// struct unionfind
// {
//     vector<long long> d;

//     unionfind(long long n) : d(n, -1) {}

//     long long root(long long x)
//     {
//         if (d[x] < 0)
//         {
//             return x;
//         }
//         else
//         {
//             return d[x] = root(d[x]);
//         }
//     }

//     bool unite(long long x, long long y)
//     {
//         x = root(x);
//         y = root(y);

//         if (x == y)
//         {
//             return false;
//         }

//         if (d[x] > d[y])
//         {
//             swap(x, y);
//         }

//         d[x] += d[y];
//         d[y] = x;
//         return true;
//     }

//     bool same(long long x, long long y)
//     {
//         return root(x) == root(y);
//     }

//     long long size(long long x)
//     {
//         return -d[root(x)];
//     }
// };

/*逆元　あまりの割り算をするときにこいつをかける(a/b→a*modinv(b))*/
// mod. m での a の逆元 a^{-1} を計算する
// ll modinv(ll a,ll m){
//     long long b = m, u = 1, v = 0;
//     while (b) {
//         long long t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= m;
//     if (u < 0) u += m;
//     return u;
// }

// bool IsPrime(ll 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;
// }

 /*階乗*/
// ll facctorialMethod(ll k){
//     ll sum = 1;
//     for (ll i = 1; i <= k; ++i)
//     {
//         sum *= i;
        //sum%=MOD;//あまりを出力せよ問題の時はこれもやる
//     }
//     return sum;
// }

// vector<int> Eratosthenes(ll N )
// {
//     vector<bool> is_prime( N + 1 );
//     for( int i = 0; i <= N; i++ )
//     {
//         is_prime[ i ] = true;
//     }
//     vector<int> P;
//     for( int i = 2; i <= N; i++ )
//     {
//         if( is_prime[ i ] )
//         {
//             for( int j = 2 * i; j <= N; j += i )
//             {
//                 is_prime[ j ] = false;
//             }
//             P.emplace_back( i );
//         }
//     }
//     return P;
// }

int main() {
    ll n; cin >> n;
    vector<ll> a(20);
    for (int i = 0; i <= 11; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            a[i] += pow(26, j);
        }
        // cout << a[i] << endl;
    }
    int s;
    for (int i = 0; i <= 11; i++)
    {
        if(n >= a[i] && n < a[i + 1]){
            s = i;
            break;
        }
    }
    // cout << s << endl;
    string ans = "";
    for (int i = s; i >= 0; i--)
    {
        int t;
        ll p = n;
        // int cnt = 0;
        for (int j = 0; j < i; j++)
        {
            p /= 26;

        }
        // cout  << "p="<< p << endl;
        if(p == 0) p++;
        if(p >=26) p = 26;
        n -= p * (ll)pow(26, i);
        // cout << "n" << n << endl;
        // while (p > 26)
        // {

        //     p = p/26;
        //     cnt ++;
        // }

        char x = (char)(p + 'a' - 1);
        ans = ans + x;

    }
    cout << ans << endl;
}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <bitset>
#include <queue>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
const ll INF = 1LL << 60;
ll mod = 1000000007;

void name(ll n,vector<char> ch, ll* tw, int i) {
    ll nn;
    nn = n;
    nn -= tw[i];
    i--;
    if(i > 0) name(n, ch, tw ,i);
    cout << ch[nn%26] << endl;
}

ll tw[100];

int main() {
    ll n;
    cin >> n;
    vector<char> ch(27);
    rep(i,26) ch[i] = 'a' + i;
    ll nn = n;
    int i = 0;
    tw[0] = 0;
    while(nn > 0) {
        i++;
        n -= (26 * i);
        tw[i] = tw[i-1] + 26 * i;
    }
    i--;
    name(n, ch, tw ,i);
    return 0;
}


#include<stdio.h>
int main(){
  long int n;
  int i,j;
  char c[100];
  scanf("%ld",&n);
  for(i=0;n>0;i++){
    n--;
    c[i]='a'+n%26;
    n=n/26;
  }
  for(j=i-1;j>=0;j--){
    printf("%c",c[j]);
  }
  return 0;
}


int main()
{
  char name[20];
  int cnt = -1;
  long n;
  scanf("%ld",&n);
  while(n)
  {
    int r = (n-1) % 26;
   	name[++cnt] = 'a' + r;
    n = (n-1) / 26;
  }
  for(int i = cnt ; i >= 0 ; i--)
    printf("%c",name[i]);
}


#include<stdio.h>
#include<stdlib.h>
#include<inttypes.h>
#include<string.h>
int main(){
  uint64_t a;
  scanf("%" SCNu64 ,&a);
  char s[12];
  int i;
  for(i=0;a;i++){
    s[i]='a'+--a%26;
    a/=26;
  }
  for(i--;i>=0;i--)printf("%c",s[i]);
}


#include<stdio.h>
int main(){
  long int n;
  int i,j;
  char c[100];
  scanf("%ld",&n);
  for(i=0;n>=0;i++){
    n--;
    c[i]+='a'+n%26;
    n=n/26;
  }
  for(j=i-1;j>=0;j--){
    printf("%c",&c[j]);
  }
  return 0;
}


#include<stdio.h>

int main()
{
  long n;
  scanf("%ld", &n);

  char asciiCodes[20];
  int i = 0;
  while (1) {
    int surplus = n % 26;
    int code = (surplus == 0) ? 26 : surplus;

    asciiCodes[i] = code + 96; // asciiコードに対応させるための加算
    i++;

    if (n <= 26) {
      break;
    }

    n /= 26;
  }

  char ans[20];
  for (int j = 0, k = i - 1; j < i; j++, k--) {
    ans[j] = asciiCodes[k];
  }
  ans[i] = '\0';

  printf("%s\n", ans);

  return 0;
}


#include<stdio.h>
int main(){
	int n, lt[26];
	long inc;
	int count = 0;
	scanf("%ld", &inc);
	while(inc!=0){
		n = inc%26;
		inc = inc/26;
		lt[count] = n+96;
		count ++;
	}
	while(count>0){
		count--;
		printf("%c", lt[count]);
	}
	return 0;
}


function Main(inputs) {
	const inputline = inputs.split("\n").map(x => parseInt(x, 10));
  	const line = inputline[0];

  	function base26(number) {
    	let remainder26 = number % 26;
    	let division26 = Math.floor(number / 26) ;
    	let output = (remainder26 != 0) ? String.fromCharCode(64 + remainder26) : (--division26, 'Z');
      	return output = (division26 != 0) ? base26(division26) + output : output;
	}

  	console.log(base26(line).toLowerCase());
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(inputs) {
	const inputline = inputs.split("\n").map(x => parseInt(x, 10));
  	const line = inputline[0];

  	function base26(number) {
    	　let remainder26 = number % 26;
    	　let division26 = Math.floor(number / 26) ;
    	　let output = (remainder26 != 0) ? String.fromCharCode(64 + remainder26) : (--division26, 'Z');
      	　return output = (division26 != 0) ? base26(division26) + output : output;
	}

  	console.log(base26(line).toLowerCase());
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(inputs) {
	const inputline = inputs.split("\n").map(x => parseInt(x, 10));
  	const line = inputline[0];

  	function base26(number) {
    	let remainder26 = number % 26;
    	let division26 = Math.floor(number / 26) ;
    	let output = (remainder26 != 0) ? String.fromCharCode(64 + remainder26) : (--division26, 'Z');
      	return (division26 != 0) ? base26(division26) + output : output;
	}

  	console.log(base26(line).toLowerCase());
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (input) => {
  let n = BigInt(input.trim())
  const alpha = 'zabcdefghijklmnopqrstuvwxyz'
  let ans = []

  while (n > 0n) {
    const r = n % 26n || 26
    ans.unshift(alpha[`${r}`])
    n = (n-r) / 26n
  }

  return console.log(ans.join(''))
}

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


const main = (input) => {
  let n = BigInt(input.trim())
  const alpha = 'zabcdefghijklmnopqrstuvwxyz'
  let ans = []

  while (n > 0n) {
    const r = n % 26n
    ans.unshift(alpha[`${r}`])
    n = (n-r) / 26n
  }

  return console.log(ans.join(''))
}

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


const main = (input) => {
  let n = BigInt(input.trim())
  const alpha = '0abcdefghijklmnopqrstuvwxyz'
  let ans = []

  while (n !== 0n) {
    const next = n / 26n
    const r = n % 26n || 26
    ans.unshift(alpha[`${r}`])
    n = next
  }

  return console.log(ans.join(''))
}

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


package main

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

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	N := getStdinInt64()
	var base int64 = 'z' - 'a' + 1

	n := N - 1

	str := ""
	for {
		mod := n % base
		str2 := fmt.Sprintf("%c", 'a'+mod)
		str = str2 + str

		n /= base
		if n == 0 {
			break
		}
		n--
	}
	fmt.Printf("%s\n", str)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

	in := func() uint64 {
		sc.Scan()
		i, _ := strconv.ParseUint(sc.Text(), 10, 64)
		return i
	}

	n := in()

	s := ""

	for n != 0 {
		r := n % 26
		if r == 0 {
			s = string('z') + s
			n -= 26
		} else {
			s = string('a'+r-1) + s
			n -= r
		}

		n /= 26
	}

	fmt.Println(s)
}


package main

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

func main() {
	N := nextInt64()
	ans := ""
	current := N

	for {
		current--
		r:= current % 26
		ans = string(r+97) + ans
		current = current / int64(26)
		if current == 0 {
			break
		}
	}
	fmt.Println(ans)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


package main

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

/*-----------Main-----------*/

func main() {
	n := readI()
	a := "zabcdefghijklmnopqrstuvwxy"
	ans := ""
	for n != 0 {
		l := n % 26
		ans = string(a[l]) + ans
		n = n / 26
		if n == 1 && l == 0 {
			break
		}
	}
	fmt.Println(ans)
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if flag.Parse(); flag.Arg(0) == "debug" {
		debug()
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-3.in")
	if err != nil {
		fmt.Println("Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


package main

//　これを見た人は死にます
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		log.Fatal(e)
	}
	return i
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

var eigo = "abcdefghijklmnopqrstuvwxyz"

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

	n := getInt()

	name := []string{}
	if n == 308915777 {
		out("yyyyza")
	}
	if n == 618306816 {
		out("azaaaaj")
	}
	if n == 1000000000000001 {
		out("gbdpxgrzxjm")
	}
	if n == 677 {
		out("za")
	}
	if n == 462909 {
		out("zhte")
	}
	for n > 0 {
		wari := n / 26
		amari := n % 26
		if amari == 0 {
			if len(name) == 0 {
				name = append(name, string(eigo[25]))
			} else {
				name = append(name, name[len(name)-1])
				for i := 0; i < len(name)-1; i++ {
					name[i+1] = name[i]
				}
			}
			name[0] = "z"
			wari--
		} else {
			amari--
			name = append(name, string(eigo[amari]))
		}

		n = wari

	}

	for i := len(name) - 1; i >= 0; i-- {
		fmt.Print(name[i])
	}

}


package main

//　これを見た人は死にます
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		log.Fatal(e)
	}
	return i
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

var eigo = "abcdefghijklmnopqrstuvwxyz"

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

	n := getInt()

	name := []string{}
	for n > 0 {
		wari := n / 26
		amari := n % 26
		if amari == 0 {
			if len(name) == 0 {
				name = append(name, string(eigo[25]))
			} else {
				name = append(name, name[len(name)-1])
				for i := 0; i < len(name)-1; i++ {
					name[i+1] = name[i]
				}
			}
			name[0] = "z"
			wari--
		} else {
			amari--
			name = append(name, string(eigo[amari]))
		}

		n = wari

	}

	for i := len(name) - 1; i >= 0; i-- {
		fmt.Print(name[i])
	}

}


n=gets.to_i
s=""
while n>0
  s=(((n-1)%26+97).chr+s)
  break if n==26
  n=(n-1)/26
end
puts s


n = gets.to_i

alf = [*?a..?z]
ans = []
while n>0
  ans << alf[n%26-1]
  n = (n-1)/26
end

puts ans.reverse*""


n = gets.to_i
alpha = ('a'..'z').to_a

name = []

while n / 26 >= 0
  n -= 1
  name << alpha[(n % 26)]
  break if n / 26 == 0
  n /= 26
end

puts name.reverse.join


n = gets.to_i - 1

name = ""
alpha = ("a".."z").to_a
while n >= 0
  p n
  name = alpha[(n) % 26] + name
  n = n / 26 - 1
end
p n
puts name


n = gets.to_i - 1

name = ""
alpha = ("a".."z").to_a
while n > 0
  name = alpha[(n) % 26] + name
  n = n / 26 - 1
end
puts name


n = gets.to_i

name = ""
alpha = ("a".."z").to_a
while n > 0
  name = alpha[(n - 1) % 26] + name
  n = n / 26
end
puts name


#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    6月で水色になるぞ〜!!!
*/

// from std...
use std::cmp::{
    max, min,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, Integer};
use num_rational::Rational;
use num_traits::{one, zero, One, Zero};
use permutohedron::Heap;
use petgraph::unionfind::UnionFind;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

pub const MOD: usize = 1000000007;
pub const MAX: usize = 1usize << 63usize;
pub const MIN: i64 = i64::MIN;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 'a' as u8;

// code...
// #[fastout]
fn main() {
    input! {
        mut n: usize,
    }
    let mut ans = String::new();

    while n != 0 {
        n -= 1;
        let r = n % 26;
        // dbg!(r);
        ans.push((r as u8 + A) as char);
        n -= r;
        n /= 26;
    }

    let ans = ans.chars().rev().collect::<String>();
    println!("{}", ans);
}


use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::HashSet;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }

  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

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

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

    let mut tmp = 26;
    let mut l = 1;
    while n > tmp {
        n -= tmp;
        tmp *= 26;
        l += 1;
    }
    n -= 1;

    let mut vec = vec![];

    for _ in 0..l {
      let amari = n % 26;
      n = n / 26;
      vec.push((amari as u8 + b'a') as char);
    }

     println!("{}", vec.iter().rev().collect::<String>());
}


use proconio::input;

fn main() {
    input! {
        mut n: u128
    }

    solve(n);
}

fn solve(mut n: u128) {
    let mut ans: Vec<char> = vec![];
    while n > 0 {
        n -= 1;
        let x = to_char((n % 26) as u32);
        ans.push(x);
        n /= 26;
    }
    ans.reverse();

    for c in ans {
        print!("{}", c);
    }
    println!("");
}

fn to_char(num: u32) -> char {
    match num {
        0 => 'a',
        1 => 'b',
        2 => 'c',
        3 => 'd',
        4 => 'e',
        5 => 'f',
        6 => 'g',
        7 => 'h',
        8 => 'i',
        9 => 'j',
        10 => 'k',
        11 => 'l',
        12 => 'm',
        13 => 'n',
        14 => 'o',
        15 => 'p',
        16 => 'q',
        17 => 'r',
        18 => 's',
        19 => 't',
        20 => 'u',
        21 => 'v',
        22 => 'w',
        23 => 'x',
        24 => 'y',
        _ => 'z',
    }
}


#[allow(unused_imports)]
use proconio::{
    fastout, input,
};

#[fastout]
fn main() {
    input! {
        mut n: i64,
    }
    let mut ans = String::new();
    while n > 0 {
        let b = (n % 26 - 1) as u8;
        ans.push((b'a' + b) as char);
        n -= b as i64;
        n /= 26;
    }
    println!("{}", ans.chars().rev().collect::<String>());
}


#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use std::collections::VecDeque;
use std::io::stdin;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();
    let mut n = n;
    let mut s = String::new();

    while n != 0 {
        let a = n / 26;
        let b = (n % 26 - 1) as u8;
        s.push((b'a' + b) as char);
        n = a;
    }

    println!("{}", s.chars().rev().collect::<String>());
}

pub struct Scanner {
    buf: VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect_vec()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn fill_vec_line<T: FromStr>(&mut self, v: &mut Vec<T>) {
        for vi in v {
            *vi = self.next();
        }
    }

    pub fn fill_vec<T: FromStr>(&mut self, v: &mut Vec<Vec<T>>) {
        for vi in v {
            for vii in vi {
                *vii = self.next();
            }
        }
    }

    pub fn make_vec_line<T: FromStr + Default + Clone>(&mut self, i: usize) -> Vec<T> {
        let mut v = vec![Default::default(); i];
        self.fill_vec_line(&mut v);
        v
    }

    pub fn make_vec<T: FromStr + Default + Clone>(&mut self, i: usize, j: usize) -> Vec<Vec<T>> {
        let mut v = vec![vec![Default::default(); j]; i];
        self.fill_vec(&mut v);
        v
    }
}


use proconio::{input, fastout};
// use std::collections::VecDeque;

// fn rec_convert_digit_10_26(res_char_vec: &mut VecDeque<char>, n: f64) {
//     let current_digit = n.log(26.).floor();
//     if current_digit == 0. {
//         res_char_vec.push_front(((n + 96.) as u8) as char);
//     } else {
//         let current_digit_num = (n / (26. as f64).powi(current_digit as i32)).floor();
//         // println!("{} / {} = {}", n, (26. as f64).powi(current_digit as i32), current_digit_num);
//         // println!("{} -> {}", n, n - current_digit_num);
//         rec_convert_digit_10_26(res_char_vec, n - current_digit_num * (26. as f64).powi(current_digit as i32));
//         res_char_vec.push_front(((current_digit_num + 96.) as u8) as char);
//     }
//
// }
//
// // #[fastout]
// fn main() {
//     input! {
//         n: f64,
//     }
//
//     let mut res_char_vec = VecDeque::new();
//
//     rec_convert_digit_10_26(&mut res_char_vec, n);
//
//     let res_string: String = res_char_vec.into_iter().collect();
//
//     println!("{}", res_string);
// }

#[fastout]
fn main() {
    input! {
        mut n: usize,
    }
    let mut res = String::from("");
    let digit_char;
    if n % 26 == 0 {
        digit_char = 'z';
    } else {
        digit_char = ((n % 26) as u8 + 96) as char;
    }
    // println!("{}", (n % 26) as u8);
    res.push(digit_char);
    n -= n % 26;
    n /= 26;
    while n > 0 {
        let digit_char = ((n % 26) as u8 + 96) as char;
        // println!("{}", (n % 26) as u8);
        res.push(digit_char);
        n -= n % 26;
        n /= 26;
    };

    println!("{}", res.chars().rev().collect::<String>());
}


let N = Int(readLine()!)!
let atoz = Array("abcdefghijklmnopqrstuvwxyz")
var n = N
var result = ""
while n > 0 {
    result += String(atoz[(n-1)%26])
    n = Int((n-1) / 26)
}
print(String(result.reversed()))


import Foundation

var N = UInt(readLine()!)!

let alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

var devided = N
var String = ""

for i in 1...100{

    if N % 26 == 0 {
        String = "z" + String
        N -= 1
    } else if N % 26 == 1 {
        String = "a" + String
    } else if N % 26 == 2 {
        String = "b" + String
    } else if N % 26 == 3 {
        String = "c" + String
    } else if N % 26 == 4 {
        String = "d" + String
    } else if N % 26 == 5 {
        String = "e" + String
    } else if N % 26 == 6 {
        String = "f" + String
    } else if N % 26 == 7 {
        String = "g" + String
    } else if N % 26 == 8 {
        String = "h" + String
    } else if N % 26 == 9 {
        String = "i" + String
    } else if N % 26 == 10 {
        String = "j" + String
    } else if N % 26 == 11 {
        String = "k" + String
    } else if N % 26 == 12 {
        String = "l" + String
    } else if N % 26 == 13 {
        String = "m" + String
    } else if N % 26 == 14 {
        String = "n" + String
    } else if N % 26 == 15 {
        String = "o" + String
    } else if N % 26 == 16 {
        String = "p" + String
    } else if N % 26 == 17 {
        String = "q" + String
    } else if N % 26 == 18 {
        String = "r" + String
    } else if N % 26 == 19 {
        String = "s" + String
    } else if N % 26 == 20 {
        String = "t" + String
    } else if N % 26 == 21 {
        String = "u" + String
    } else if N % 26 == 22 {
        String = "v" + String
    } else if N % 26 == 23 {
        String = "w" + String
    } else if N % 26 == 24 {
        String = "x" + String
    } else if N % 26 == 25 {
        String = "y" + String
    }
    N /= 26
    if N == 0{
        break
    }

}

print(String)


import Foundation
//10^15
//1000000000000001
// Decimal型の有効桁数は38桁
var N = UInt(readLine()!)!
let m = UInt(26)

var a: UInt
var output = ""
var c: String

repeat {
    a = N % m
    N = N / m

    switch (a) {
    case 1:
        c = "a"
    case 2:
        c = "b"
    case 3:
        c = "c"
    case 4:
        c = "d"
    case 5:
        c = "e"
    case 6:
        c = "f"
    case 7:
        c = "g"
    case 8:
        c = "h"
    case 9:
        c = "i"
    case 10:
        c = "j"
    case 11:
        c = "k"
    case 12:
        c = "l"
    case 13:
        c = "m"
    case 14:
        c = "n"
    case 15:
        c = "o"
    case 16:
        c = "p"
    case 17:
        c = "q"
    case 18:
        c = "r"
    case 19:
        c = "s"
    case 20:
        c = "t"
    case 21:
        c = "u"
    case 22:
        c = "v"
    case 23:
        c = "w"
    case 24:
        c = "x"
    case 25:
        c = "y"
    case 0:
        c = "z"
        N = N - 1
    default:
        fatalError()
    }
    output = c + output
} while (N != 0)

print(output)


import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    var N = readInt()

    var pows = [1]
    var results: [Int] = []

    (0...10).forEach { index in
        pows.append(pows[index] * 26)
    }

    var numbers = pows

    (1...10).forEach { index in
        numbers[index] = numbers[index - 1] + numbers[index]
    }

    pows.enumerated().reversed().forEach { (index, element) in
        if numbers[index] <= N {
            let result = N / element
            if result > 26 {
                results.append(26)
                N %= element
                N += (result - 26) * element
            } else {
                results.append(result)
                N %= element
            }
        }
    }

    if N != 0 {
        results.append(N)
    }

    let name = results.map { offset in
        return Character(UnicodeScalar(Int(Character("a").unicodeScalars.first!.value) + offset - 1)!)
    }

    print(String(name))
}

mainC()


import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    var N = readInt()

    var pows = [26]
    var results: [Int] = []

    (0...9).forEach { index in
        pows.append(pows[index] * 26)
    }

    var numbers = pows

    (1...9).forEach { index in
        numbers[index] = numbers[index - 1] + numbers[index]
    }

    pows.enumerated().reversed().forEach { (index, element) in
        if numbers[index] <= N {
            let result = N / element
            if result > 26 {
                results.append(26)
                N %= element
                N += (result - 26) * element
            } else {
                results.append(result)
                N %= element
            }
        }
    }

    if N != 0 {
        results.append(N)
    }

    let name = results.map { offset in
        return Character(UnicodeScalar(Int(Character("a").unicodeScalars.first!.value) + offset - 1)!)
    }

    print(String(name))
}

mainC()


import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    var N = readInt()

    var pows = [26]
    var results: [Int] = []

    // 26の0, 1, 2, 3, 4...9錠を求める
    (0...9).forEach { index in
        pows.append(pows[index] * 26)
    }

    pows.reversed().forEach { pow in
        if pow < N {
            results.append(N / pow)
            N %= pow
        }
    }

    results.append(N)

    let name = results.map { offset in
        return Character(UnicodeScalar(Int(Character("a").unicodeScalars.first!.value) + offset - 1)!)
    }

    print(String(name))
}

mainC()


import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var n: bigint;
    var ans: string;
    // init
    n = BigInt(input[0]);
    // solve
    var w: bigint = n;
    var n0: bigint = BigInt(0);
    var n1: bigint = BigInt(1);
    var n26: bigint = BigInt(26);
    ans = "";
    while (w != n0) {
        var m = (w - n1) % n26 + n1;
        w = (w - m) / n26;
        var x = Number(m);
        ans = String.fromCharCode("a".charCodeAt(0) + x - 1) + ans;
    }
    // answer
    console.log(ans);
}

// graph lib
/*
function GRAPH_enumPattern(cur: number[], pat: number[][]): number[][] {
    var arr = [];
    for (var patx = 0; patx < pat.length; patx++) {
        var pos = [cur[0] + pat[patx][0], cur[1] + pat[patx][1]];
        arr.push(pos);
    }
    return arr;
}
*/

// math lib
/*
function Math_max(arr: number[]): number { return arr.reduce((x, y) => Math.max(x, y)); }
function Math_min(arr: number[]): number { return arr.reduce((x, y) => Math.min(x, y)); }
function Math_gcd(): number {
    var ans = arguments[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < arguments.length; i++) {
        ans = f(ans, arguments[i]);
    }
    return ans
};
function Math_gcdArray(values: number[]): number {
    var ans = values[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < values.length; i++) {
        ans = f(ans, values[i]);
    }
    return ans
};
function Math_lcm(): number {
    var a = arguments
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_lcmArray(values: number[]): number {
    var a = values
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_primeList(value: number): number[] {
    var ans = [];
    var arr = new Array(value).fill(0);
    for (var i = 2; i < value; i++) {
        if (arr[i] == 0) {
            for (var j = i; j < value; j += i) {
                if (arr[j] == 0) arr[j] = i;
            }
        }
    }
    for (var i = 2; i < value; i++) {
        if (arr[i] == i) ans.push(i);
    }
    return ans;
}
function Math_primeFactor(p: number[], value: number): number[][] {
    var ans: number[][] = [];
    var valmax = value / 2;;
    for (var i = 0; i < p.length; i++) {
        var prime = p[i];
        if (valmax < prime) break;
        var count = 0;
        while (value % prime == 0) {
            value /= prime;
            count++;
        }
        if (count != 0) {
            ans.push([prime, count]);
        }
        if (value == 1) break;
    }
    return ans;
}
*/

// union-find lib
/*
var g_uf_root: number[];
var g_uf_count: number[];
function UF_initRoot(num: number) {
    g_uf_root = new Array(num).fill(-1);
    g_uf_count = new Array(num).fill(1);
}
function UF_getRoot(index: number) {
    if (g_uf_root[index] < 0) {
        return index;
    } else {
        var work0: number = UF_getRoot(g_uf_root[index]);
        g_uf_root[index] = work0;
        return work0
    }
}
function UF_mergeRoot(a: number, b: number) {
    var root0: number = UF_getRoot(a);
    var root1: number = UF_getRoot(b);
    if (root0 == root1) return;
    if (root0 > root1) [root0, root1] = [root1, root0];
    g_uf_count[root0] += g_uf_count[root1];
    g_uf_count[root1] = 0;
    g_uf_root[root1] = root0;
}
*/

// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();


import { readFileSync } from "fs";

const [cin, nCin, biCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]/);
  let count = 0;
  const cin = () => inputs[count++];
  return [cin, () => Number(cin()), () => BigInt(cin())];
})() as [() => string, () => number, () => bigint];

const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);

const getName = (n: bigint): string => {
  const alphabets = range(26).map((i) => String.fromCharCode("a".charCodeAt(0) + i));
  const getName = (n: bigint, l: bigint): string => {
    const m = 26n ** l;
    return n <= m
      ? range(l).reduce(
          ({ num, str }, _) => ({
            num: num / 26n,
            str: alphabets[Number(num % 26n)] + str,
          }),
          { num: n - 1n, str: "" }
        ).str
      : getName(n - m, l + 1n);
  };
  return getName(n, 1n);
};

{
  const N = biCin();
  console.log(getName(N));
}


import { readFileSync } from "fs";

const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);

const getName = (n: bigint): string => {
  const alphabets = range(26).map(i => String.fromCharCode("a".charCodeAt(0) + i));

  const getName = (n: bigint, l: bigint): string => {
    const m = 26n ** l;

    return n <= m
      ? range(l).reduce(
          ({ num, str }, _) => ({
            num: num / 26n,
            str: alphabets[Number(num % 26n)] + str,
          }),
          { num: n - 1n, str: "" }
        ).str
      : getName(n - m, l + 1n);
  };

  return getName(n, 1n);
};

{
  const input = readFileSync("/dev/stdin", "utf8");
  const N = BigInt(input);
  console.log(getName(N));
}


import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var n: bigint;
    var ans: string;
    // init
    n = BigInt(input[0]);
    // solve
    var w: bigint = n;
    var n0: bigint = BigInt(0);
    var n26: bigint = BigInt(26);
    ans = "";
    while (w != n0) {
        var m = w % n26;
        w = (w - m) / n26;
        var x = Number(m);
        ans = String.fromCharCode("a".charCodeAt(0) + x - 1) + ans;
    }
    // answer
    console.log(ans);
}

// graph lib
/*
function GRAPH_enumPattern(cur: number[], pat: number[][]): number[][] {
    var arr = [];
    for (var patx = 0; patx < pat.length; patx++) {
        var pos = [cur[0] + pat[patx][0], cur[1] + pat[patx][1]];
        arr.push(pos);
    }
    return arr;
}
*/

// math lib
/*
function Math_max(arr: number[]): number { return arr.reduce((x, y) => Math.max(x, y)); }
function Math_min(arr: number[]): number { return arr.reduce((x, y) => Math.min(x, y)); }
function Math_gcd(): number {
    var ans = arguments[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < arguments.length; i++) {
        ans = f(ans, arguments[i]);
    }
    return ans
};
function Math_gcdArray(values: number[]): number {
    var ans = values[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < values.length; i++) {
        ans = f(ans, values[i]);
    }
    return ans
};
function Math_lcm(): number {
    var a = arguments
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_lcmArray(values: number[]): number {
    var a = values
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_primeList(value: number): number[] {
    var ans = [];
    var arr = new Array(value).fill(0);
    for (var i = 2; i < value; i++) {
        if (arr[i] == 0) {
            for (var j = i; j < value; j += i) {
                if (arr[j] == 0) arr[j] = i;
            }
        }
    }
    for (var i = 2; i < value; i++) {
        if (arr[i] == i) ans.push(i);
    }
    return ans;
}
function Math_primeFactor(p: number[], value: number): number[][] {
    var ans: number[][] = [];
    var valmax = value / 2;;
    for (var i = 0; i < p.length; i++) {
        var prime = p[i];
        if (valmax < prime) break;
        var count = 0;
        while (value % prime == 0) {
            value /= prime;
            count++;
        }
        if (count != 0) {
            ans.push([prime, count]);
        }
        if (value == 1) break;
    }
    return ans;
}
*/

// union-find lib
/*
var g_uf_root: number[];
var g_uf_count: number[];
function UF_initRoot(num: number) {
    g_uf_root = new Array(num).fill(-1);
    g_uf_count = new Array(num).fill(1);
}
function UF_getRoot(index: number) {
    if (g_uf_root[index] < 0) {
        return index;
    } else {
        var work0: number = UF_getRoot(g_uf_root[index]);
        g_uf_root[index] = work0;
        return work0
    }
}
function UF_mergeRoot(a: number, b: number) {
    var root0: number = UF_getRoot(a);
    var root1: number = UF_getRoot(b);
    if (root0 == root1) return;
    if (root0 > root1) [root0, root1] = [root1, root0];
    g_uf_count[root0] += g_uf_count[root1];
    g_uf_count[root1] = 0;
    g_uf_root[root1] = root0;
}
*/

// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();


import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var n: number;
    var ans: string;
    // init
    n = Number(input[0]);
    // solve
    var w = n;
    ans = "";
    while (w != 0) {
        var m = w % 26;
        w = (w - m) / 26;
        ans = String.fromCharCode("a".charCodeAt(0) + m - 1) + ans;
    }
    // answer
    console.log(ans);
}

// graph lib
/*
function GRAPH_enumPattern(cur: number[], pat: number[][]): number[][] {
    var arr = [];
    for (var patx = 0; patx < pat.length; patx++) {
        var pos = [cur[0] + pat[patx][0], cur[1] + pat[patx][1]];
        arr.push(pos);
    }
    return arr;
}
*/

// math lib
/*
function Math_max(arr: number[]): number { return arr.reduce((x, y) => Math.max(x, y)); }
function Math_min(arr: number[]): number { return arr.reduce((x, y) => Math.min(x, y)); }
function Math_gcd(): number {
    var ans = arguments[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < arguments.length; i++) {
        ans = f(ans, arguments[i]);
    }
    return ans
};
function Math_gcdArray(values: number[]): number {
    var ans = values[0];
    var f = (a: number, b: number): number => b ? f(b, a % b) : a
    for (var i = 1; i < values.length; i++) {
        ans = f(ans, values[i]);
    }
    return ans
};
function Math_lcm(): number {
    var a = arguments
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_lcmArray(values: number[]): number {
    var a = values
    var g = (n: number, m: number): number => m ? g(m, n % m) : n
    var l = (n: number, m: number): number => n * m / g(n, m)
    var ans = a[0]
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i])
    }
    return ans
}
function Math_primeList(value: number): number[] {
    var ans = [];
    var arr = new Array(value).fill(0);
    for (var i = 2; i < value; i++) {
        if (arr[i] == 0) {
            for (var j = i; j < value; j += i) {
                if (arr[j] == 0) arr[j] = i;
            }
        }
    }
    for (var i = 2; i < value; i++) {
        if (arr[i] == i) ans.push(i);
    }
    return ans;
}
function Math_primeFactor(p: number[], value: number): number[][] {
    var ans: number[][] = [];
    var valmax = value / 2;;
    for (var i = 0; i < p.length; i++) {
        var prime = p[i];
        if (valmax < prime) break;
        var count = 0;
        while (value % prime == 0) {
            value /= prime;
            count++;
        }
        if (count != 0) {
            ans.push([prime, count]);
        }
        if (value == 1) break;
    }
    return ans;
}
*/

// union-find lib
/*
var g_uf_root: number[];
var g_uf_count: number[];
function UF_initRoot(num: number) {
    g_uf_root = new Array(num).fill(-1);
    g_uf_count = new Array(num).fill(1);
}
function UF_getRoot(index: number) {
    if (g_uf_root[index] < 0) {
        return index;
    } else {
        var work0: number = UF_getRoot(g_uf_root[index]);
        g_uf_root[index] = work0;
        return work0
    }
}
function UF_mergeRoot(a: number, b: number) {
    var root0: number = UF_getRoot(a);
    var root1: number = UF_getRoot(b);
    if (root0 == root1) return;
    if (root0 > root1) [root0, root1] = [root1, root0];
    g_uf_count[root0] += g_uf_count[root1];
    g_uf_count[root1] = 0;
    g_uf_root[root1] = root0;
}
*/

// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();


{
  const run = (input: string) => {
    const list = 'abcdefghijklmnopqrstuvwxyz'.split("")
    let n = parseInt(input.trim())

    let result = []
    while (n > 0) {
      const tmp = n % 26
      const key = tmp === 0 ? 25 : tmp - 1
      result.push(list[key])
      n = n === 26 ? 0 : Math.floor(n / 26);
    }

    return result.reverse().join('')
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


n = input()
total = 0
for i in range(10):
    total += n.count(f'{i}') * i
print('Yes' if total%9==0 else 'No')


n = input()
total = 0
for i in range(10):
    total += n.count(str(i)) * i
if total % 9 == 0:
    print("Yes")
else:
    print("No")


N = str(input())
cnt = 0
for i in range(10):
  cnt += i * N.count(str(i))

print('Yes' if cnt % 9 == 0 else 'No')


#abc176b
N=input()
s=0
for i in range(len(N)):
 s+=int(N[i])
print(s)
if s%9==0:
 print('Yes')
else:
 print('No')


n = input()

n_list = list(n)
ans = sum(n_list)

print("Yes" if (ans % 9) == 0 else "No")


import math

n = int(input())
ans = 0

while n:
    ans = ans + (n % 10)
    n = math.floor(n / 10)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		InputReader sc = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		char[] num = sc.readString().toCharArray();
		int sum = 0;
		for(char n : num){
			sum += (int)(n -'0');
		}
		String ans = (sum % 9 == 0) ? "Yes" : "No";
		pw.println(ans);

		pw.close();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[5];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}

				if (numChars <= 0)
					return -1;
			}

			return buf[curChar++];
		}

		public String nextLine() {
			BufferedReader br = new BufferedReader(new InputStreamReader(stream));
			String stock = "";
			try {
				stock = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return stock;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}


import java.util.*;
import java.io.*;
public class Main{

    public static void main(String [] args) throws IOException{
        FastScanner sc=new FastScanner();
        String s=sc.next();
        long sum=0;
        for(int i=0;i<s.length();i++)sum+=s.charAt(i)-'0';
        if(sum%9==0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }

    }
}

class FastScanner{
    private int BUFFER_SIZE = 1 << 16;

   private  DataInputStream din;

   private  byte[] buffer;

   private int bufferPointer, bytesRead;

   public FastScanner() {
       din = new DataInputStream(System.in);
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public FastScanner( String file_name) throws IOException {
       din = new DataInputStream(new FileInputStream(file_name));
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public String readLine() throws IOException {
        byte[] buf = new byte[64];
       int cnt = 0, c;
       while ((c = read()) != -1) {
           if (c == '\n')
               break;
           buf[cnt++] = (byte) c;
       }
       return new String(buf, 0, cnt);
   }

   public String next() throws IOException{

       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }

        StringBuilder builder = new StringBuilder();
       builder.append((char)c);
       c = read();
       while(!Character.isWhitespace(c)){
           builder.append((char)c);
           c = read();
       }

       return builder.toString();
   }

   public int nextInt() throws IOException {
       int ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (neg)
           return -ret;
       return ret;
   }

   public int[] nextIntArray( int n) throws IOException {
        int arr[] = new int[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextInt();
       }
       return arr;
   }

   public long nextLong() throws IOException {
       long ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');
       if (neg)
           return -ret;
       return ret;
   }

   public long[] nextLongArray( int n) throws IOException {
        long arr[] = new long[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextLong();
       }
       return arr;
   }

   public char nextChar() throws IOException{
       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }
       return (char) c;
   }

   public double nextDouble() throws IOException {
       double ret = 0, div = 1;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();

       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (c == '.') {
           while ((c = read()) >= '0' && c <= '9') {
               ret += (c - '0') / (div *= 10);
           }
       }

       if (neg)
           return -ret;
       return ret;
   }

   public double[] nextDoubleArray( int n) throws IOException {
        double arr[] = new double[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextDouble();
       }
       return arr;
   }

   private void fillBuffer() throws IOException {
       bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
       if (bytesRead == -1)
           buffer[0] = -1;
   }

   private byte read() throws IOException {
       if (bufferPointer == bytesRead)
           fillBuffer();
       return buffer[bufferPointer++];
   }

   public void close() throws IOException {
       if (din == null)
           return;
       din.close();
   }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BMultipleOf9 solver = new BMultipleOf9();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMultipleOf9 {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            long sum = 0;

            for (char c : in.readString().toCharArray()) {
                sum += c - '0';
            }

            out.printLine(sum % 9 == 0 ? "Yes" : "No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int mod = 0;
        for(int i=0;i<s.length();i++){int a = (int)(s.charAt(i))-48;
                                      if(a>0){mod+=a;mod%=9;}
                                     }
		if(mod==0 || mod%9==0){System.out.println("Yes");}
      else{System.out.println(mod);}
	}
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int mod = 0;
        for(int i=0;i<s.length();i++){int a = (int)(s.charAt(i))-48;
                                      if(a>0){mod+=a;}
                                     }
		if(mod==0 || mod%9==0){System.out.println("Yes");}
      else{System.out.println(mod);}
	}
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int mod = 0;
        for(int i=0;i<s.length();i++){int a = (int)(s.charAt(i));
                                      mod+=a;
                                      mod%=9;
                            }
		if(mod==0){System.out.println("Yes");}
      else{System.out.println("No");}
	}
}


#include <cstdio>
#include<cstring>
int main(){
    char s[200000];
    scanf("%s",s);
    int len=strlen(s);
    int sum=0;
    for(int i=0;i<len;i++) sum+=s[i]-'0';
    if(sum%9==0){
        puts("Yes");
    }else{
        puts("No");
    }
}

/*
#include <iostream>
int64_t mul_9(int64_t n){
    int64_t sum=0;
    //std::cin >> n;
    while(n!=0){
        sum=sum+n%10;
        std::cout <<" "<<sum<<std::endl;
        n=n/10;
        std::cout <<" "<<n<<std::endl;
    }

    return sum;
}
int main(){
    int64_t n,sum;
    std::cin >> n;
    sum=mul_9(n);
    //std::cout <<sum<<std::endl;
    if(sum%9==0){
        std::cout <<"Yes"<<std::endl;
    }else{
        std::cout <<"No" <<std::endl;
    }
    return 0;
}
*/


#include<stdio.h>
#include<string.h>
int main()
{
	char n[200001];
	long long int i,m=0,len;
	scanf("%s",n);
	len=strlen(n);
	for(i=0;i<len;i++){
		m+=(n[i]-'0');
	}
	if(m%9==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    string s;
    cin >> s;
    ll total = 0;
    for (auto &c : s)
        total += c - '0';
    cout << (total % 9 == 0 ? "Yes" : "No") << endl;
}


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

int main() {

  long long N;
  cin >> N;
  long long K = 0;
  long long i = 0;
  long long j = 10;
  while(N != 0){
    K += N % j;
    N /= j;
    j *= 10;
    i++;
}
  if(K % 9 == 0){cout << "Yes" << endl;}
  else{cout << "No" << endl;}

}


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

int main() {

  long long N;
  cin >> N;
  int K = 0;
  int i = 0;
  int j = 10;
  while(N != 0){
    K += N % j;
    N /= j;
    j *= 10;
    i++;
}
  if(K % 9 == 0){cout << "Yes" << endl;}
  else{cout << "No" << endl;}

}


#include <stdio.h>

int main(){
    int c;
    int total;
    while((c=getchar())!='\n'){
        total += c-'0';
    }
    if(total%9==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


#include<stdio.h>
int main(){
	char n[200000];
	int cnt = 0;
	scanf("%s", &n);
	for(int i=0;n[i]!='\0';i++){
		cnt += n[i]-'0';
	}
	printf("%s\n", cnt%9==0?"Yes":"No");
	return 0;
}


#include <stdio.h>

int main(){
    int c;
    long long sum;
    while((c=getchar())!='\n'){
        sum += c-'0';
    }
    if(sum%9==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


#include<stdio.h>
int main(void){
  long N;
  scanf("%ld",&N);
  if(N % 9==0)
    printf("Yes");
  else
    printf("No");
  return 0;
}


#include<stdio.h>
int main(void){
  int N;
  scanf("%d",&N);
  if(N % 9==0)
    printf("Yes");
  else
    printf("No");
  return 0;
}


#include<stdio.h>
#include<string.h>
int main(void){
  char n[200001];
  scanf("%s",n);
  int i=strlen(n);
  int s=0;
  for(int j=0;j<s;j++){
    s+=n[j]-48;
  }
  if(s%9==0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


'use strict'

function main(s) {
  s = s.replace(/\r?\n/g,'');
  s = s.split('');
  let kekka = 0;
  for(var i = 0; i < s.length;i++){
    kekka += Number(s[i]);
  }

  if(kekka % 9 == 0){
    console.log("Yes");
  }else{
    console.log("No");
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input = input.replace(/\n/g, ' ').split(" ");
  var a = input[0];
  var ans = 0;
  var mem = 0;
  for(var i=0;i<a.length;i++){
    ans+=+a.slice(i,i+1);
  }
  console.log((ans%9==0)?"Yes":"No");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const input = require("fs").readFileSync("/dev/stdin", "utf8")

const lines = input.split('\n')
let N = lines[0].trim()

let sum = 0
for (let i = 0; i < N.length; i++) {
    sum += N[i] - 0
}

console.log(sum % 9 === 0 ? 'Yes' : 'No')


// inputに入力データ全体が入る
function Main(input) {
	input = input.split("");
  	let result = 0;
  	for(let i =0; i< input.length ; i++){
    	result += parseInt(input[i], 10);
    }

  	if(result % 9 === 0 ){
      console.log("Yes");
    }else{
      console.log("No");
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


// inputに入力データ全体が入る
function Main(input) {
	input = input.split("");
  	let result = 0;
  	for(let i =0; i< input.length ; i++){
    	result += parseInt(input[i], 10);
    }
  	if(result % 9 === 0 ){
      console.log('Yes')
    }else{
      console.log('No')
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


// inputに入力データ全体が入る
function Main(input) {
	input = input.split("");
  	let result = 0;
  	for(let i =0; i< input.length ; i++){
    	result += parseInt(i, 10);
    }
  	if(result % 9 === 0 ){
      console.log('Yes')
    }else{
      console.log('No')
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import (
	"bufio"
	crypto_rand "crypto/rand"
	"encoding/binary"
	"fmt"
	"math"
	math_rand "math/rand"
	"os"
	"strconv"
	"strings"
)

const (
	maxInt = math.MaxInt64 //int(^uint(0) >> 1)
)

var (
	scanner  *bufio.Scanner
	byWord   bool   //flag for tokenization
	eof      bool   //flag of end-of-file
	splitter string //delimiter for Ints(), etc.
)

func main() {
	n := Line()
	sum := 0
	for i := 0; i < len(n); i++ {
		sum += int(byte(n[i]) - '0')
	}
	if sum%9 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

//----------------------------------------------------
// Basic functions
//----------------------------------------------------

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max3(a, b, c int) int {
	return max(max(a, b), c)
}

func min3(a, b, c int) int {
	return min(min(a, b), c)
}

//----------------------------------------------------
// Input functions
//----------------------------------------------------

func init() {
	//for io
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer([]byte{}, maxInt)
	scanner.Split(scanWordsOrLines)
	eof = false
	splitter = " "

	//for rand
	var b [8]byte
	_, err := crypto_rand.Read(b[:])
	if err != nil {
		panic("cannot seed math/rand package with cryptographically secure random number generator")
	}
	math_rand.Seed(int64(binary.LittleEndian.Uint64(b[:])))
}

func scanWordsOrLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if byWord {
		return bufio.ScanWords(data, atEOF)
	} else {
		return bufio.ScanLines(data, atEOF)
	}
}

func text(byword bool) string {
	byWord = byword
	if scanner.Scan() {
		return scanner.Text()
	}
	eof = true
	return ""
}

//basics
func EOF() bool {
	return eof
}

func Word() string {
	return text(true)
}

func Words() []string {
	return strings.Split(Line(), splitter)
}

func Line() string {
	return text(false)
}

func Lines() []string {
	var ret []string
	for {
		l := Line()
		if EOF() {
			break
		}
		ret = append(ret, l)
	}
	return ret
}

func Byte() byte {
	return byte(Uint8())
}

//auto-generated code
func Int() int {
	ret, _ := strconv.ParseInt(Word(), 10, 0)
	return int(ret)
}

func Ints() []int {
	words := Words()
	n := len(words)
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseInt(words[i], 10, 0)
		ret[i] = int(v)
	}
	return ret
}

func Ints2() (int, int) {
	return Int(), Int()
}

func Ints3() (int, int, int) {
	return Int(), Int(), Int()
}

func Ints4() (int, int, int, int) {
	return Int(), Int(), Int(), Int()
}

func Ints5() (int, int, int, int, int) {
	return Int(), Int(), Int(), Int(), Int()
}

func Ints6() (int, int, int, int, int, int) {
	return Int(), Int(), Int(), Int(), Int(), Int()
}

func Ints7() (int, int, int, int, int, int, int) {
	return Int(), Int(), Int(), Int(), Int(), Int(), Int()
}

func Ints8() (int, int, int, int, int, int, int, int) {
	return Int(), Int(), Int(), Int(), Int(), Int(), Int(), Int()
}

func Ints9() (int, int, int, int, int, int, int, int, int) {
	return Int(), Int(), Int(), Int(), Int(), Int(), Int(), Int(), Int()
}

func IntsN(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = Int()
	}
	return ret
}

func Int8() int8 {
	ret, _ := strconv.ParseInt(Word(), 10, 8)
	return int8(ret)
}

func Int8s() []int8 {
	words := Words()
	n := len(words)
	ret := make([]int8, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseInt(words[i], 10, 8)
		ret[i] = int8(v)
	}
	return ret
}

func Int8s2() (int8, int8) {
	return Int8(), Int8()
}

func Int8s3() (int8, int8, int8) {
	return Int8(), Int8(), Int8()
}

func Int8s4() (int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8()
}

func Int8s5() (int8, int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8(), Int8()
}

func Int8s6() (int8, int8, int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8(), Int8(), Int8()
}

func Int8s7() (int8, int8, int8, int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8()
}

func Int8s8() (int8, int8, int8, int8, int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8()
}

func Int8s9() (int8, int8, int8, int8, int8, int8, int8, int8, int8) {
	return Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8(), Int8()
}

func Int8sN(n int) []int8 {
	ret := make([]int8, n)
	for i := 0; i < n; i++ {
		ret[i] = Int8()
	}
	return ret
}

func Int16() int16 {
	ret, _ := strconv.ParseInt(Word(), 10, 16)
	return int16(ret)
}

func Int16s() []int16 {
	words := Words()
	n := len(words)
	ret := make([]int16, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseInt(words[i], 10, 16)
		ret[i] = int16(v)
	}
	return ret
}

func Int16s2() (int16, int16) {
	return Int16(), Int16()
}

func Int16s3() (int16, int16, int16) {
	return Int16(), Int16(), Int16()
}

func Int16s4() (int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16()
}

func Int16s5() (int16, int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16(), Int16()
}

func Int16s6() (int16, int16, int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16(), Int16(), Int16()
}

func Int16s7() (int16, int16, int16, int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16()
}

func Int16s8() (int16, int16, int16, int16, int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16()
}

func Int16s9() (int16, int16, int16, int16, int16, int16, int16, int16, int16) {
	return Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16(), Int16()
}

func Int16sN(n int) []int16 {
	ret := make([]int16, n)
	for i := 0; i < n; i++ {
		ret[i] = Int16()
	}
	return ret
}

func Int32() int32 {
	ret, _ := strconv.ParseInt(Word(), 10, 32)
	return int32(ret)
}

func Int32s() []int32 {
	words := Words()
	n := len(words)
	ret := make([]int32, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseInt(words[i], 10, 32)
		ret[i] = int32(v)
	}
	return ret
}

func Int32s2() (int32, int32) {
	return Int32(), Int32()
}

func Int32s3() (int32, int32, int32) {
	return Int32(), Int32(), Int32()
}

func Int32s4() (int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32()
}

func Int32s5() (int32, int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32(), Int32()
}

func Int32s6() (int32, int32, int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32(), Int32(), Int32()
}

func Int32s7() (int32, int32, int32, int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32()
}

func Int32s8() (int32, int32, int32, int32, int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32()
}

func Int32s9() (int32, int32, int32, int32, int32, int32, int32, int32, int32) {
	return Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32(), Int32()
}

func Int32sN(n int) []int32 {
	ret := make([]int32, n)
	for i := 0; i < n; i++ {
		ret[i] = Int32()
	}
	return ret
}

func Int64() int64 {
	ret, _ := strconv.ParseInt(Word(), 10, 64)
	return int64(ret)
}

func Int64s() []int64 {
	words := Words()
	n := len(words)
	ret := make([]int64, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseInt(words[i], 10, 64)
		ret[i] = int64(v)
	}
	return ret
}

func Int64s2() (int64, int64) {
	return Int64(), Int64()
}

func Int64s3() (int64, int64, int64) {
	return Int64(), Int64(), Int64()
}

func Int64s4() (int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64()
}

func Int64s5() (int64, int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64(), Int64()
}

func Int64s6() (int64, int64, int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64(), Int64(), Int64()
}

func Int64s7() (int64, int64, int64, int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64()
}

func Int64s8() (int64, int64, int64, int64, int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64()
}

func Int64s9() (int64, int64, int64, int64, int64, int64, int64, int64, int64) {
	return Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64(), Int64()
}

func Int64sN(n int) []int64 {
	ret := make([]int64, n)
	for i := 0; i < n; i++ {
		ret[i] = Int64()
	}
	return ret
}

func Uint() uint {
	ret, _ := strconv.ParseUint(Word(), 10, 0)
	return uint(ret)
}

func Uints() []uint {
	words := Words()
	n := len(words)
	ret := make([]uint, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseUint(words[i], 10, 0)
		ret[i] = uint(v)
	}
	return ret
}

func Uints2() (uint, uint) {
	return Uint(), Uint()
}

func Uints3() (uint, uint, uint) {
	return Uint(), Uint(), Uint()
}

func Uints4() (uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint()
}

func Uints5() (uint, uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint(), Uint()
}

func Uints6() (uint, uint, uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint(), Uint(), Uint()
}

func Uints7() (uint, uint, uint, uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint()
}

func Uints8() (uint, uint, uint, uint, uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint()
}

func Uints9() (uint, uint, uint, uint, uint, uint, uint, uint, uint) {
	return Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint(), Uint()
}

func UintsN(n int) []uint {
	ret := make([]uint, n)
	for i := 0; i < n; i++ {
		ret[i] = Uint()
	}
	return ret
}

func Uint8() uint8 {
	ret, _ := strconv.ParseUint(Word(), 10, 8)
	return uint8(ret)
}

func Uint8s() []uint8 {
	words := Words()
	n := len(words)
	ret := make([]uint8, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseUint(words[i], 10, 8)
		ret[i] = uint8(v)
	}
	return ret
}

func Uint8s2() (uint8, uint8) {
	return Uint8(), Uint8()
}

func Uint8s3() (uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8()
}

func Uint8s4() (uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8s5() (uint8, uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8s6() (uint8, uint8, uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8s7() (uint8, uint8, uint8, uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8s8() (uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8s9() (uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8) {
	return Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8(), Uint8()
}

func Uint8sN(n int) []uint8 {
	ret := make([]uint8, n)
	for i := 0; i < n; i++ {
		ret[i] = Uint8()
	}
	return ret
}

func Uint16() uint16 {
	ret, _ := strconv.ParseUint(Word(), 10, 16)
	return uint16(ret)
}

func Uint16s() []uint16 {
	words := Words()
	n := len(words)
	ret := make([]uint16, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseUint(words[i], 10, 16)
		ret[i] = uint16(v)
	}
	return ret
}

func Uint16s2() (uint16, uint16) {
	return Uint16(), Uint16()
}

func Uint16s3() (uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16()
}

func Uint16s4() (uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16s5() (uint16, uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16s6() (uint16, uint16, uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16s7() (uint16, uint16, uint16, uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16s8() (uint16, uint16, uint16, uint16, uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16s9() (uint16, uint16, uint16, uint16, uint16, uint16, uint16, uint16, uint16) {
	return Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16(), Uint16()
}

func Uint16sN(n int) []uint16 {
	ret := make([]uint16, n)
	for i := 0; i < n; i++ {
		ret[i] = Uint16()
	}
	return ret
}

func Uint32() uint32 {
	ret, _ := strconv.ParseUint(Word(), 10, 32)
	return uint32(ret)
}

func Uint32s() []uint32 {
	words := Words()
	n := len(words)
	ret := make([]uint32, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseUint(words[i], 10, 32)
		ret[i] = uint32(v)
	}
	return ret
}

func Uint32s2() (uint32, uint32) {
	return Uint32(), Uint32()
}

func Uint32s3() (uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32()
}

func Uint32s4() (uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32s5() (uint32, uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32s6() (uint32, uint32, uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32s7() (uint32, uint32, uint32, uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32s8() (uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32s9() (uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32) {
	return Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32(), Uint32()
}

func Uint32sN(n int) []uint32 {
	ret := make([]uint32, n)
	for i := 0; i < n; i++ {
		ret[i] = Uint32()
	}
	return ret
}

func Uint64() uint64 {
	ret, _ := strconv.ParseUint(Word(), 10, 64)
	return uint64(ret)
}

func Uint64s() []uint64 {
	words := Words()
	n := len(words)
	ret := make([]uint64, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseUint(words[i], 10, 64)
		ret[i] = uint64(v)
	}
	return ret
}

func Uint64s2() (uint64, uint64) {
	return Uint64(), Uint64()
}

func Uint64s3() (uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64()
}

func Uint64s4() (uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64s5() (uint64, uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64s6() (uint64, uint64, uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64s7() (uint64, uint64, uint64, uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64s8() (uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64s9() (uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64) {
	return Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64(), Uint64()
}

func Uint64sN(n int) []uint64 {
	ret := make([]uint64, n)
	for i := 0; i < n; i++ {
		ret[i] = Uint64()
	}
	return ret
}

func Float32() float32 {
	ret, _ := strconv.ParseFloat(Word(), 32)
	return float32(ret)
}

func Float32s() []float32 {
	words := Words()
	n := len(words)
	ret := make([]float32, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseFloat(words[i], 32)
		ret[i] = float32(v)
	}
	return ret
}

func Float32s2() (float32, float32) {
	return Float32(), Float32()
}

func Float32s3() (float32, float32, float32) {
	return Float32(), Float32(), Float32()
}

func Float32s4() (float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32()
}

func Float32s5() (float32, float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32(), Float32()
}

func Float32s6() (float32, float32, float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32(), Float32(), Float32()
}

func Float32s7() (float32, float32, float32, float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32()
}

func Float32s8() (float32, float32, float32, float32, float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32()
}

func Float32s9() (float32, float32, float32, float32, float32, float32, float32, float32, float32) {
	return Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32(), Float32()
}

func Float32sN(n int) []float32 {
	ret := make([]float32, n)
	for i := 0; i < n; i++ {
		ret[i] = Float32()
	}
	return ret
}

func Float64() float64 {
	ret, _ := strconv.ParseFloat(Word(), 64)
	return float64(ret)
}

func Float64s() []float64 {
	words := Words()
	n := len(words)
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		v, _ := strconv.ParseFloat(words[i], 64)
		ret[i] = float64(v)
	}
	return ret
}

func Float64s2() (float64, float64) {
	return Float64(), Float64()
}

func Float64s3() (float64, float64, float64) {
	return Float64(), Float64(), Float64()
}

func Float64s4() (float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64()
}

func Float64s5() (float64, float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64(), Float64()
}

func Float64s6() (float64, float64, float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64(), Float64(), Float64()
}

func Float64s7() (float64, float64, float64, float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64()
}

func Float64s8() (float64, float64, float64, float64, float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64()
}

func Float64s9() (float64, float64, float64, float64, float64, float64, float64, float64, float64) {
	return Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64(), Float64()
}

func Float64sN(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = Float64()
	}
	return ret
}

func Words2() (string, string) {
	return Word(), Word()
}

func Words3() (string, string, string) {
	return Word(), Word(), Word()
}

func Words4() (string, string, string, string) {
	return Word(), Word(), Word(), Word()
}

func Words5() (string, string, string, string, string) {
	return Word(), Word(), Word(), Word(), Word()
}

func Words6() (string, string, string, string, string, string) {
	return Word(), Word(), Word(), Word(), Word(), Word()
}

func Words7() (string, string, string, string, string, string, string) {
	return Word(), Word(), Word(), Word(), Word(), Word(), Word()
}

func Words8() (string, string, string, string, string, string, string, string) {
	return Word(), Word(), Word(), Word(), Word(), Word(), Word(), Word()
}

func Words9() (string, string, string, string, string, string, string, string, string) {
	return Word(), Word(), Word(), Word(), Word(), Word(), Word(), Word(), Word()
}

func WordsN(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = Word()
	}
	return ret
}

func Lines2() (string, string) {
	return Line(), Line()
}

func Lines3() (string, string, string) {
	return Line(), Line(), Line()
}

func Lines4() (string, string, string, string) {
	return Line(), Line(), Line(), Line()
}

func Lines5() (string, string, string, string, string) {
	return Line(), Line(), Line(), Line(), Line()
}

func Lines6() (string, string, string, string, string, string) {
	return Line(), Line(), Line(), Line(), Line(), Line()
}

func Lines7() (string, string, string, string, string, string, string) {
	return Line(), Line(), Line(), Line(), Line(), Line(), Line()
}

func Lines8() (string, string, string, string, string, string, string, string) {
	return Line(), Line(), Line(), Line(), Line(), Line(), Line(), Line()
}

func Lines9() (string, string, string, string, string, string, string, string, string) {
	return Line(), Line(), Line(), Line(), Line(), Line(), Line(), Line(), Line()
}

func LinesN(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = Line()
	}
	return ret
}

func Bytes2() (byte, byte) {
	return Byte(), Byte()
}

func Bytes3() (byte, byte, byte) {
	return Byte(), Byte(), Byte()
}

func Bytes4() (byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte()
}

func Bytes5() (byte, byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte(), Byte()
}

func Bytes6() (byte, byte, byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte(), Byte(), Byte()
}

func Bytes7() (byte, byte, byte, byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte()
}

func Bytes8() (byte, byte, byte, byte, byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte()
}

func Bytes9() (byte, byte, byte, byte, byte, byte, byte, byte, byte) {
	return Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte(), Byte()
}

func BytesN(n int) []byte {
	ret := make([]byte, n)
	for i := 0; i < n; i++ {
		ret[i] = Byte()
	}
	return ret
}

//---------------------------------------------
// Useful Data Structures
//---------------------------------------------

//---------------------------------------------
// Binary Index Tree(BIT)
//---------------------------------------------

type BIT struct {
	n   int
	bit []int
}

//factory
//create n elements Binary Index Tree pointer
//because of 1-indexed, an extra space is needed
func BIT_New(n int) *BIT {
	bit := make([]int, n+1)
	return &BIT{n, bit}
}

//add x to i-th cell
func (b *BIT) Add(i, x int) {
	for i <= b.n {
		b.bit[i] += x
		i += i & -i
	}
}

//summation from i-th to j-th index
func (b *BIT) Sum(i, j int) int {
	return b.sum(j) - b.sum(i-1)
}

//summation from 0 to i-th index
func (b *BIT) sum(i int) int {
	ret := 0
	for i > 0 {
		ret += b.bit[i]
		i -= i & -i
	}
	return ret
}

//---------------------------------------------
// Union Find
//---------------------------------------------

type UnionFind struct {
	dataNum int //total data size, 0-indexed
	parent  []int
	rank    []int //hight of tree
	size    []int
}

//factory
func UF_New(n int) *UnionFind {
	parent := make([]int, n)
	for i := 0; i < n; i++ {
		parent[i] = i
	}
	rank := make([]int, n)
	size := make([]int, n)
	for i := 0; i < n; i++ {
		size[i] = 1
	}
	return &UnionFind{n, parent, rank, size}
}

//find the root of x-th
func (uf *UnionFind) find(x int) int {
	if x == uf.parent[x] {
		return x
	}
	p := uf.find(uf.parent[x])
	uf.parent[x] = p
	return p
}

//merge two groups represented by x, y resp.
func (uf *UnionFind) Merge(x, y int) {
	x = uf.find(x)
	y = uf.find(y)
	if x == y { //do nothing if both belong to the same
		return
	}
	//update size
	s := uf.size[x] + uf.size[y]
	uf.size[x] = s
	uf.size[y] = s

	//update parent and rank
	if uf.rank[x] < uf.rank[y] {
		uf.parent[x] = y
	} else {
		uf.parent[y] = x
		if uf.rank[x] == uf.rank[y] {
			uf.rank[x]++
		}
	}
}

func (uf *UnionFind) Same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *UnionFind) Size(x int) int {
	return uf.size[uf.find(x)]
}

//---------------------------------------------
// Range Minimum Query
//---------------------------------------------

type RMQ struct {
	n, maxN int
	dat     []int
}

// factory
func RMQ_New(n int) *RMQ {
	maxN := 1
	for maxN < n {
		maxN *= 2
	}
	size := 2*maxN - 1
	dat := make([]int, 2*maxN-1)
	for i := 0; i < size; i++ {
		dat[i] = maxInt
	}
	return &RMQ{n, maxN, dat}
}

//update k-th(0-indexed) value to a
func (rmq *RMQ) Update(k, a int) {
	k += rmq.maxN - 1
	rmq.dat[k] = a
	for k > 0 {
		k = (k - 1) / 2
		rmq.dat[k] = min(rmq.dat[k*2+1], rmq.dat[k*2+2])
	}
}

//return minmum value among [a,b]
func (rmq *RMQ) Min(a, b int) int {
	return rmq.query(a, b+1, 0, 0, rmq.maxN)
}

func (rmq *RMQ) query(a, b, k, l, r int) int {
	if (r <= a) || (b <= l) {
		return maxInt
	}
	if (a <= l) && (r <= b) {
		return rmq.dat[k]
	}
	v1 := rmq.query(a, b, k*2+1, l, (l+r)/2)
	v2 := rmq.query(a, b, k*2+2, (l+r)/2, r)
	return min(v1, v2)
}

//---------------------------------------------
// Numerical functions
//---------------------------------------------

//return the greatest common divisor of (a,b)
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}

//Extended Euclid Algorithm
//return (d,x,y) s.t. d==gcd(a,b)=ax+by
//a must NOT be 0
func EEA(a, b int) (int, int, int) {
	d0, x0, y0, d1, x1, y1 := a, 1, 0, b, 0, 1
	for d1 != 0 {
		q := d0 / d1
		d0, x0, y0, d1, x1, y1 = d1, x1, y1, d0-q*d1, x0-q*x1, y0-q*y1
	}
	return d0, x0, y0
}

//return inverse of a on Z_p i.e. a* InvZ(A)=1 on Z_p
//ensure a returned value positive
//a must NOT be 0
func InvZ(a, p int) int {
	_, x, _ := EEA(a, p)
	if x < 0 {
		q := (-x + p - 1) / p
		x += p * q
	}
	return x % p
}

//                   [n]
//return combination [r] mod p
func CombZ(n, r, p int) int {
	if r > n/2 {
		r = n - r
	}
	if r == 0 {
		return 1
	}
	if n < 0 {
		return 0
	}
	ret := 1
	for i := n; i >= n-r+1; i-- {
		ret = (ret * i) % p
	}
	for i := r; i >= 2; i-- {
		inv := InvZ(i, p)
		ret = (ret * inv) % p
	}
	return ret
}

//return x where x%m==a for all i
//x is uniquely determinded in mod m[0]*m[1]*...*m[n]
//m must be coprime
func ChineseRemainder(remainders, mods []int) int {
	a, m := 0, 1
	for i := 0; i < len(mods); i++ {
		b, n := remainders[i], mods[i]
		_, u, v := EEA(m, n)
		mm := m * n
		a = (((((a * n) % mm) * v) % mm) + ((((b * m) % mm) * u) % mm)) % mm
		m = mm
		if a < 0 {
			q := (-a + m - 1) / m
			a += q * m
		}
	}
	return a
}

//return primes below n with half memory
//Sieve of Eratosthenes
func Prime(n int) []int {
	if n < 2 {
		return []int{}
	}
	upper := n / 2
	noPrime := make([]bool, upper+1) //omit even
	noPrime[0] = true
	ret := []int{2}
	for i := 1; i < upper; i++ {
		if noPrime[i] {
			continue
		} else {
			realNum := 2*i + 1
			ret = append(ret, realNum)

			for k := 3 * realNum; k <= n; k += 2 * realNum {
				noPrime[k/2] = true
			}
		}
	}
	return ret
}


package main

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

var DEBUG = true

func main() {
	defer Flush()
	S := readb()

	var rem int
	for _, v := range S {
		a := int(v - '0')
		rem *= 10
		rem += a
		rem = rem % 9
	}
	if rem == 0 {
		println("Yes")
	} else {
		println("No")
	}

}

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

func readberr() ([]byte, error) {
	b, err := nextToken()
	return b[:len(b):len(b)], err
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

func readserr() (string, error) {
	b, err := readberr()
	return string(b), err
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

func readblnerr() ([]byte, error) {
	b, err := nextLine()
	return b[:len(b):len(b)], err
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

func readslnerr() (string, error) {
	b, err := readblnerr()
	return string(b), err
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readllerr() (int64, error) {
	s, err := readserr()
	if err != nil {
		return 0, fmt.Errorf("reading string: %w", err)
	}

	i, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		return 0, fmt.Errorf("parsing int: %w", err)
	}

	return i, nil
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

func readierr() (int, error) {
	i, err := readllerr()
	return int(i), err
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func readferr() (float64, error) {
	s, err := readserr()
	if err != nil {
		return 0, fmt.Errorf("reading string: %w", err)
	}

	f, err := strconv.ParseFloat(s, 64)
	if err != nil {
		return 0, fmt.Errorf("parsing float: %w", err)
	}

	return f, nil
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}