fn main() {
    let mut input = String::new();
    let _ = std::io::stdin().read_line(&mut input);
    let input: i32 = input.trim().parse().unwrap();

    let numbers = vec![6, 2, 5, 5, 4, 5, 6, 3, 7, 6];

    let digit = input / numbers[1];
    let mut picked_index = vec![1; digit as usize];
    let mut rest = input % numbers[1];
    for i in (0..digit as usize).rev() {
        if rest == 0 {
            break;
        }
        for j in (1..10).rev() {
            if rest + numbers[picked_index[i] as usize] >= numbers[j] {
                rest = rest + numbers[picked_index[i] as usize] - numbers[j];
                picked_index[i] = j;
                break;
            }
        }
    }
    let result = picked_index.iter().rev().map(|x| x.to_string()).collect::<String>();
    println!("{}", result);
}