#![allow(unused_imports)]
#![allow(unused_macros)]
#[cfg(test)]
#[cfg(test)]
extern crate quickcheck;
#[cfg(test)]
#[macro_use(quickcheck)]
extern crate quickcheck_macros;
use itertools::Itertools;
use num::complex::Complex;
use std::cmp::{max, min};
use std::collections::*;
use std::i64;
use std::io::{stdin, Read};
use std::usize;

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

use std::cmp::Ordering;
use std::ops::{Mul, Sub};

fn cross<T: Mul<Output = T> + Sub<Output = T>>(a: Complex<T>, b: Complex<T>) -> T {
    a.re * b.im - a.im * b.re
}
fn argcmp(a: &Complex<i64>, b: &Complex<i64>) -> Ordering {
    use std::cmp::Ordering::*;
    let a = *a;
    let b = *b;
    if a.re == 0 && a.im == 0 {
        if b.re == 0 && b.im == 0 {
            return Equal;
        } else {
            return Less;
        }
    }
    if b.re == 0 && b.im == 0 {
        return Greater;
    }
    let c = cross(a, b);
    if c == 0 && a.re * b.re + a.im * b.im >= 0 {
        return Equal;
    }
    if a.im >= 0 {
        if c < 0 && b.im >= 0 {
            Greater
        } else {
            Less
        }
    } else {
        if c > 0 && b.im < 0 {
            Less
        } else {
            Greater
        }
    }
}

fn arg(a: &Complex<i64>) -> f64 {
    let a = Complex {
        re: a.re as f64,
        im: a.im as f64,
    };
    let ret = a.arg();
    if ret < 0. {
        ret + 2. * std::f64::consts::PI
    } else {
        ret
    }
}
fn argcmp2(a: &Complex<i64>, b: &Complex<i64>) -> Ordering {
    arg(a).partial_cmp(&arg(b)).unwrap()
}

#[cfg(test)]
#[quickcheck]
fn test(ar: i64, ai: i64, br: i64, bi: i64) {
    let a = Complex { re: ar, im: ai };
    let b = Complex { re: br, im: bi };
    assert_eq!(argcmp(&a, &b), argcmp2(&a, &b));
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize);
    let mut xs = vec![];
    for _ in 0..n {
        parse!(it, x: i64, y: i64);
        if x != 0 || y != 0 {
            xs.push(Complex::new(x, y));
        }
    }
    use std::cmp::Ordering::*;
    xs.sort_by(argcmp2);
    let n = xs.len();
    let mut ret = xs.iter().cloned().sum::<Complex<i64>>().norm_sqr();
    for l in 0..n {
        for r in l..=n {
            ret.chmax(xs[l..r].iter().cloned().sum::<Complex<i64>>().norm_sqr());
            if r < n {
                ret.chmax(
                    xs[..l]
                        .iter()
                        .chain(xs[r..].iter())
                        .cloned()
                        .sum::<Complex<_>>()
                        .norm_sqr(),
                );
            } else {
                ret.chmax(xs[..l].iter().cloned().sum::<Complex<i64>>().norm_sqr());
            }
        }
    }
    println!("{}", (ret as f64).sqrt());
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2972