//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

use std::io::Write;

fn mod_pow(r: u32, mut n: u32, p: u32) -> u32 {
    let mut t = 1;
    let mut s = r % p;
    while n > 0 {
        if (n & 1) == 1 {
            t = t * s % p;
        }
        s = s * s % p;
        n >>= 1;
    }
    t
}

//(x - b) をかける
fn mul(a: &Vec<u32>, b: u32, p: u32) -> Vec<u32> {
    let mut res = vec![0; a.len() + 1];
    for i in 0..a.len() {
        res[i] = (res[i] + a[i] * (p - b)) % p;
        res[i + 1] = (res[i + 1] + a[i]) % p;
    }
    res
}

fn mul_constant(a: &Vec<u32>, k: u32, p: u32) -> Vec<u32> {
    let mut res = vec![0; a.len()];
    for i in 0..a.len() {
        res[i] = a[i] * k % p;
    }
    res
}

fn add(a: &Vec<u32>, b: &Vec<u32>, p: u32) -> Vec<u32> {
    let mut res = vec![0; std::cmp::max(a.len(), b.len())];
    for i in 0..a.len() {
        res[i] = (res[i] + a[i]) % p;
    }
    for i in 0..b.len() {
        res[i] = (res[i] + b[i]) % p;
    }
    res
}

fn div(a: &Vec<u32>, y: u32, p: u32) -> Vec<u32> {
    let mut res = vec![0; a.len() - 1];
    let mut b = a.clone();
    for i in (1..a.len()).rev() {
        res[i - 1] = b[i];
        b[i - 1] = (b[i - 1] + y * b[i]) % p;
    }
    res
}

fn eval(a: &Vec<u32>, x: u32, p: u32) -> u32 {
    let mut v = 0;
    for a in a.iter().rev() {
        v = (v * x + *a) % p;
    }
    v
}

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        p: usize,
        a: [u32; p],
    }
    let mut fact = vec![1; 1];
    for i in 0..p {
        fact = mul(&fact, i as u32, p as u32);
    }
    let mut ans = vec![0; p];
    for i in 0..p {
        if a[i] == 0 {
            continue;
        }
        let mut f = 1;
        for j in 0..i {
            f = f * (p + j - i) as u32 % p as u32;
        }
        for j in (i + 1)..p {
            f = f * (j - i) as u32 % p as u32;
        }
        let i = i as u32;
        let p = p as u32;
        let x = div(&fact, i, p);
        let x = mul_constant(&x, mod_pow(f, p - 2, p), p);
        ans = add(&ans, &x, p);
    }
    for i in 0..p {
        assert!(eval(&ans, i as u32, p as u32) == a[i]);
        if i > 0 {
            write!(out, " ").unwrap();
        }
        write!(out, "{}", ans[i]).unwrap();
    }
    writeln!(out, "").unwrap();
}

fn main() {
    run();
}


Measured memory_bytes: 4352