#![allow(dead_code,unused_variables)]
use proconio::{fastout, input};

fn pow(x : usize, k:usize) -> Modint{
    let mut tmp :Modint = 1.into();
    let mut m = k;
    let mut d : Modint = x.into();
    if k == 0{
        return 1.into();
    }
    while m > 0{
        if m&1 == 1{
            tmp *= d;
        }
        d *= d;
        m >>= 1;
    }
    tmp
}

#[fastout]
fn main() {
    input!{
        p: usize,
        a:[usize;p],
    }
    unsafe{MOD = p;}

    let mut b : Vec<Modint> = vec![0.into();p];
    let mut cnt : Modint = 0.into();
    let c = Combination::new(3000,p);
    for i in 0..p{
        if a[i] == 0{
            continue;
        }
        cnt += 1.into();
        for j in 0..p{
            let d = c.comb(p-1,j) * pow(i,p-1-j);
            if (p-1-j)%2 == 1{
                b[j] += d;
            }else{
                b[j] -= d;
            }
        }
    }
    b[0] += cnt;

    for i in 0..p{
        if i>0{
            print!(" ");
        }
        print!("{}",b[i]);
    }
    println!("");
}

use std::ops::*;
use std::mem::swap;
use std::fmt;

static mut MOD:usize = 0;

#[derive(Copy,Clone)]
pub struct Modint{
    val : usize,
}

impl Modint{
    pub fn new(val : usize) -> Self{
        Modint{
            val : unsafe{val%MOD},
        }
    }

    fn inv(&self) -> Self{
        let mut x : i32= 1;
        let mut u : i32= 0;
        let mut s : i32= self.val as i32;
        let mut t : i32= unsafe{MOD as i32};

        while t != 0{
            let k = s/t;
            s -= k * t;
            swap(&mut s,&mut t);
            x -= k * t;
            swap(&mut x, &mut u);
        }
        x %= unsafe{MOD as i32};
        if x < 0{
            x += unsafe{MOD as i32};
        }
        
        let x = x as usize;
        Modint{
            val : x,
        }
    }
}

impl Add for Modint{
    type Output = Self;

    fn add(self, rhs: Self) -> Self {
        Self {
            val : unsafe{(self.val + rhs.val) % MOD},
        }
    }
}

impl AddAssign for Modint {
    fn add_assign(&mut self, rhs: Modint) {
        *self = *self + rhs;
    }
}

impl Sub for Modint{
    type Output = Self;

    fn sub(self, other: Self) -> Self {
        Self {
            val :unsafe{(MOD + self.val - other.val) % MOD},
        }
    }
}

impl SubAssign for Modint {
    fn sub_assign(&mut self, rhs: Modint) {
        *self = *self - rhs;
    }
}

impl Mul for Modint {
    type Output = Modint;

    fn mul(self, rhs: Modint) -> Self {
        Modint{
            val : unsafe{(self.val * rhs.val) % MOD},
        }
    }
}

impl MulAssign for Modint {
    fn mul_assign(&mut self, rhs: Modint) {
        *self = *self * rhs;
    }
}

impl Div for Modint {
    type Output = Modint;

    fn div(self, rhs: Modint) -> Self {
        Modint{
            val : unsafe{(self.val * rhs.inv().val) % MOD},
        }
    }
}

impl DivAssign for Modint {
    fn div_assign(&mut self, rhs: Modint) {
        *self = *self / rhs;
    }
}

impl From<i32> for Modint{
    fn from(x : i32) -> Self {
        let mut tmp = x;
        while tmp < 0{
            tmp += unsafe{MOD as i32};
        }
        let res = Modint::new(tmp as usize);
        res
    }
}

impl From<usize> for Modint{
    fn from(x : usize) -> Self {
        let res = Modint::new(x);
        res
    }
}

impl fmt::Display for Modint{
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.val)
    }
}

pub struct Combination{
    fac : Vec<usize>,
    finv : Vec<usize>,
    m : usize,
}

impl Combination{
    pub fn new(n : usize, m : usize) -> Self{
        let mut inv = vec![1;n+1];
        let mut fac = vec![1;n+1];
        let mut finv = vec![1;n+1];

        for i in 2..(n+1){
            fac[i] = (fac[i-1] * i) % m;
            inv[i] = m - (inv[m%i] * (m/i) % m);
            finv[i] = (finv[i-1]*inv[i])%m;
        }

        Combination{
            fac,
            finv,
            m,
        }
    }

    pub fn comb(&self, n : usize, k: usize) -> Modint{
        if n < k{
            return 0.into();
        }

        Modint{val:(self.fac[n] * (self.finv[k] * self.finv[n-k] % self.m)) % self.m}
    }
}


Measured memory_bytes: 2340