jiahuimbzuai/CoQuIR huggingface dataset:
//  [rust]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn is_ok(s: &Vec<char>) -> bool {
    let n = s.len();
    if n % 2 != 0 {
        return false;
    }
    for i in 0..n/2 {
        if s[i] != s[i + n/2] {
            return false;
        }
    }
    true
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let mut S: Vec<char> = sc.chars();
    let N = S.len();
    for _ in 0..N {
        S.pop();
        if is_ok(&S) {
            println!("{}", S.len());
            return;
        }
    }
    unreachable!();
}
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

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

#[fastout]
fn main() {
    input!{
        s: Chars,
    }

    let mut s_1: Vec<char> = s.clone();
    let l = s_1.len();
    for i in 1..l/2 {
        for j in 0..2 {
            s_1.pop();
        }
        let mut ok = true;
        for j in 0..s_1.len()/2 {
            if s_1[j]==s_1[s_1.len()/2+j] {
                continue;
            } else {
                ok = false;
                break;
            }
        }
        if ok==true {
            println!("{}", s_1.len());
            return;
        }
        debug!(s_1);
    }
}
//  [rust]
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

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

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        mut s: Chars,
    }

    s.pop();
    s.pop();
    while s[0..s.len() / 2] != s[s.len() / 2..s.len()] {
        s.pop();
        s.pop();
        if s.len() == 0 {
            break;
        }
    }
    println!("{}", s.len());
}
//  [rust]
use itertools::Itertools;

fn main() {
    proconio::input! {
    a:String,
  }
    let a=a.chars().collect_vec();
    let mut b = 0;
    let mut c = 0;
    for i in 1..a.len()/2 {
        for j in 0..i {
            if a[j] != a[j+i] {
                c+=1;
            }
        }
        if c==0 {b=i}
        c=0
    }
    println!("{}",b*2);
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

var S = readLine()!.toArray()
for _ in 0..<S.count-1 {
    S.removeLast()
    if S.count % 2 > 0 {
        continue
    }
    let firstHalf = (0..<S.count/2).map{S[$0]}
    let secondHalf = (S.count/2..<S.count).map{S[$0]}
    if firstHalf == secondHalf {
        print(S.count)
        break
    }
}
//  [swift]
import Foundation

let s = readLine()!
var c = s.count
var ans = 0
for i in (2...c).reversed() {
  if i % 2 != 0 { continue }
  let strl = s.prefix(i / 2)
  let l = s.index(s.startIndex, offsetBy: i / 2)
  let r = s.index(s.startIndex, offsetBy: i)
  let strr = s[l..<r]
  if strl == strr && i != s.count{
    ans = i
    break
  }
}
print(ans)
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let s=ts().split('')
  s.pop()
  let m=s.length;
  for(let i=0;i<m;i++){
    if(s.length%2==1){
      s.pop()
      continue
    }
    if((s.slice(0,s.length/2)).join('')==(s.slice(s.length/2)).join('')){
      to(s.length)
      return
    }
    s.pop()
  }
}
main()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];

  for (let i = 2; i < S.length; i += 2) {
    const firstHalf = S.slice(0, (S.length - i) / 2);
    const secondHalf = S.slice((S.length - i) / 2, i * -1);

    if (firstHalf === secondHalf) {
      return S.length - i;
    }
  }

  return 0;
};

console.log(main(read()));
//  [python]
import numpy as np
n, m = map(int, input().split())

switches = []
for i in range(m):
  a = list(map(int,input().split()))
  switches.append(a[1:])

p = list(map(int,input().split()))

ans = 0
# bit全探索
for t in range(2 ** n):
  # N個のスイッチのうち,onになっているスイッチの数を調べる
  on_switch_list = np.array([t >> s & 1 for s in range(n)])
  
  # 各電球に対しonになっているスイッチの合計%2のリストを作り,pと等しければカウント
  # iは 1 ~ Mの値を取るので-1してインデックスに使えるように
  if p == [np.sum(on_switch_list[np.array(i) - 1]) % 2 for i in switches]:
    ans += 1
print(ans)
//  [python]
from itertools import product
import numpy as np

N, M = map(int, input().split())
liS_all = []
denkyuM = [0 for i in range(M)]
cnt = 0

for j in range(1, M + 1):
    liS = list(map(int, input().split()))
    denkyulist = [0 for k in range(N)]
    for l in liS[1:]:
        denkyulist[l-1] = 1
    liS_all.append(denkyulist)

liP = list(map(int, input().split()))

bit_list = list(product([0, 1], repeat = N))

for bit in bit_list:
    n = 0
    judge = True
    for denkyu in liS_all:
        ronriseki = np.logical_and(bit, denkyu)
        if sum(ronriseki) % 2 != liP[n]:
            judge = False
        n += 1
    if judge == True:
        cnt += 1
print(cnt)
//  [python]
from numpy import *

n, m = map(int, input().split())
s = [[int(x) for x in input().split()][1:] for y in range(m)]
p = [int(z) for z in input().split()]
ans = 0

for i in range(2**n):
    b = array([(i>>j)&1 for j in range(n)])
    if [sum(b[array(k) - 1]) % 2 for k in s] == p:
        ans += 1
print(ans)
//  [java]
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] k = new int[M];
		int[][] s = new int[M][];
		for (int i = 0; i < M; i++) {
			k[i] = sc.nextInt();
			s[i] = new int[k[i]];
			for (int j = 0; j < k[i]; j++) {
				s[i][j] = sc.nextInt() - 1;
			}
		}

		int[] p = new int[M];
		for (int i = 0; i < M; i++) {
			p[i] = sc.nextInt();
		}

		sc.close();

		int ans = 0;

		for (int bit = 0; bit < (1 << N); bit++) {
//			System.err.println(Integer.toBinaryString(bit));
			int light = 1;
			// 電球iが点灯するか
			for (int i = 0; i < M; i++) {
				int n = 0;
				for (int j = 0; j < k[i]; j++) {
//					System.err.println("[[ " + j + "," + k[i]);
					if (((bit >> s[i][j]) & 1) == 1) {
						System.err.println(j + " switch on");
						n++;
					}
				}
				System.err.println("i=" + i + "  n=" + n + "  p[i]=" + p[i]);
				if (n % 2 != p[i]) {
//					System.err.println("x");
					light = 0;
				} else {
//					System.err.println("o");

				}
			}

			if (light == 1) {
				System.err.println("ok");

				ans++;
			}

		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        int N = Integer.parseInt(arr[0]);
        int M = Integer.parseInt(arr[1]);

        List<List<String>> list = new ArrayList<>();
        List<String> pList = new ArrayList<>();

        for (int i = 0; i < M; i++) {
            String[] arr2 = br.readLine().split(" ");
            int length = Integer.parseInt(arr2[0]);
            list.add(Arrays.asList(Arrays.copyOfRange(arr2, 1, length + 1)));
        }

        pList = Arrays.asList(br.readLine().split(" "));
        int pow = (int)Math.pow(2, N);
        List<List<Integer>> list2 = new ArrayList<>();
        for (int i = 0; i < pow; i++) {
            String val = Integer.toBinaryString(i);
            String bin = String.format("%0"+ N + "d", Integer.valueOf(val));
            List<Integer> l = Arrays.stream(bin.split(""))
                .map(Integer::parseInt)
                .collect(Collectors.toList());
            list2.add(l);
        }

        int ans = 0;

        for (int i = 0; i < list2.size(); i++) {
            List<Integer> l = list2.get(i);
            Set<String> onSet = new HashSet<>();
            Set<String> offSet = new HashSet<>();
            for (int j = 0; j < l.size(); j++) {
                if (l.get(j) == 0) {
                    offSet.add(String.valueOf(j + 1));
                } else {
                    onSet.add(String.valueOf(j + 1));
                }
            }

            for (int j = 0; j < list.size(); j++) {
                List<String> sl = list.get(j);
                int onCount = 0;
                for (String s: sl) {
                    if (onSet.contains(s)) {
                        onCount++;
                    }
                }
                if (onCount % 2 != Integer.parseInt(pList.get(j))) {
                    break;
                }
                if (j == list.size() - 1) {
                    ans++;
                }
            }
        }

        out.println(ans);
        out.close();
    }
}
//  [java]
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        List<List<Integer>> s = new ArrayList<>(M);
        for(int i = 0; i < M; i++) {
            int k = sc.nextInt();
            s.add(new ArrayList<>(k));
            for(int j = 0; j < k; j++) {
                int a = sc.nextInt();
                a--;
                s.get(i).add(a);
            }
        }
        List<Integer> p = new ArrayList<>();
        for(int i = 0; i < M; i++) {
            p.add(sc.nextInt());
        }

        long res = 0;
        for(int bit = 0; bit < (1 << N); bit++) {
            boolean ok = true;
            for(int i = 0; i < M; i++) {
                int count = 0;
                for(int t : s.get(i)) {
                    if(((bit >> t) & 1) == 1) count++;
                }
                if(count % 2 != p.get(i)) ok = false;
            }
            if(ok) res++;
        }
        System.out.println(res);
    }
}
//  [cpp]
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) x.begin(),x.end()
#define len(x) (int)(x).size()
//#define endl "\n"
#define m_p make_pair
#define int long long


using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ld,ld> pari;

ld PI = 3.14159265358979323846;


struct Point{
    string a;
    int x,ind;
};

typedef tree<int, null_type, less<int >,
    rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void volodya22(){
    #ifdef THERE
        freopen("input.txt", "r", stdin);
    //    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
    cout << fixed;
}


int n,m;
const int N = 1e6+7;
const int alphabet = 256;
const int INF = 1e18;
const ll MOD = 1e9+7;
const ld eps = 1e-10;
const int L = 30;

int m1 = 137*137*137*137*13;
int m2 = 1e9+9;
//int p = 347;

vi path[N];
int p[N];

void input(){
    cin >> n >> m;
    for(int i = 0;i < m;i++){
        int k;
        cin >> k;
        while(k--){
            int a;
            cin >> a;
            path[i].push_back(a-1);
        }
    }

    for(int i = 0;i < m;i++) cin >> p[i];
}

int ans[N];
int cnt = 0;
int c[N];

int f(){
    memset(c,0,sizeof(c));
    for(int i = 0;i < m;i++){
        for(int j : path[i]){
            c[i] += ans[j];
        }
        if(c[i]%2 != p[i]) return 0;
    }
    return 1;
}

void rec(int x){
    if(x == n){
        cnt += f();
        return ;
    }
    ans[x] = 1;
    rec(x+1);
    ans[x] = 0;
    rec(x+1);
}

void solve(){
    rec(0);
    cout << cnt;
}

signed main(){
    volodya22();
    input();
    solve();
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void subBin(string str, int n);
bool contains(vector<int> vec, int number);

vector<string> perm;
int idx;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<int> k(m);
    vector<vector<int>> s(m);
    for (size_t i = 0; i < m; i++)
    {
        cin >> k[i];

        vector<int> si(k[i]);
        for (size_t j = 0; j < k[i]; j++)
        {
            cin >> si[j];
        }
        s[i] = si;
    }

    vector<int> p(m);
    for (size_t i = 0; i < m; i++)
    {
        cin >> p[i];
    }

    //n個のスイッチについて、on(1)/off(0)の組み合わせ
    vector<string> tmp(2 << (n - 1));
    perm = tmp;
    idx = 0;
    subBin("", n);

    int cnt = 0;
    for (size_t i = 0; i < 2 << (n - 1); i++)
    {
        bool light = true;
        for (size_t j = 0; j < m; j++)
        {
            int scnt = 0;
            for (size_t k = 0; k < perm.size(); k++)
            {
                if (contains(s[j], k + 1) && perm[i][k] == '1')
                {
                    scnt++;
                }
            }
            if (scnt % 2 != p[j])
            {
                //cout << j << " " << p[j] << " " << perm[i] << endl;
                light = false;
                break;
            }
        }
        if (light)
        {
            //cout << perm[i] << endl;
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

bool contains(vector<int> vec, int number)
{
    auto itr = find(vec.begin(), vec.end(), number);
    size_t index = distance(vec.begin(), itr);
    if (index != vec.size())
    {
        return true;
    }
    else
    {
        return false;
    }
}

void subBin(string str, int n)
{
    if (n == 0)
    {
        //cout << str << endl;
        perm[idx] = str;
        idx++;
    }
    if (n > 0)
    {
        subBin(str + "0", n - 1);
        subBin(str + "1", n - 1);
    }
}
//  [c]
#include <stdio.h>

int main()
{
  int n,m,i,j,count;
  scanf("%d%d",&n,&m );

  int k[11],s[11][11],p[11];
  int bit;
  int ans =0;

  for(i=0; i<m; i++){
    scanf("%d", &k[i]);
      for(j=0; j<k[i]; j++)
        scanf("%d",&s[i][j]);
  }
  for(i=0; i<m; i++)
    scanf("%d", &p[i]);


  for(bit = 0; bit < (1<<n); bit++){//スイッチパターンをbit全探索するループ
    for(i = 0; i<m; i++){ //i番目の電球が点灯するかどうか調べる
      count = 0;
      for(j = 0; j<k[i]; j++){
        if(bit & (1 << (s[i][j] - 1)))
        //i番目の電球につながっているスイッチそれぞれがonの場合、count++
          count++;
      }
      if(count%2 != p[i]){ //i番目の電球が点灯しない場合は次のスイッチパターンへ
        break;
      }
      if(i == (m-1)){ //m-1個の電球が全て点灯した場合、ans++
        ans++;
      }
    }
  }

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

  return 0;
}
//  [c]
#include<stdio.h>

int N, M, k[11], s[11][11], p[11];
int ans = 0;

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main()
{
  int n,m,i,j,cnt,ans=0,bit;
  int k[11],s[11][11],p[11];

  scanf("%d%d",&n,&m );

  for(i=0; i<m; i++){
    scanf("%d",&k[i]);
    for(j=0; j<k[i]; j++){
      scanf("%d", &s[i][j]);
    }
  }
  for(i=0; i<m; i++)
    scanf("%d", &p[i]);


    for(bit=0; bit<(1<<n); bit++)
    {
      for(i=0; i<m; i++){
        cnt = 0;
          for(j=0; j<k[i]; j++)
            {
              if(bit & (1<<(s[i][j] - 1)) )
              cnt++;
            }
        if(cnt%2 != p[i])
          break;
        if(i == (m-1))
          ans++;
      }

    }

  printf("%d",ans );
}
//  [javascript]
"use strict";

function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0], 10);
  var M = parseInt(input[0].split(" ")[1], 10);
  var k = [];

  for (var index = 1; index <= M; index++) {
    var element = input[index].split(" ").map(function (v) {
      return parseInt(v, 10);
    });
    k.push(element);
  }

  var p = input[M + 1].split(" ").map(function (v) {
    return parseInt(v, 10);
  });
  var init = [];
  var combs = [init];

  for (var _index = 0; _index < N; _index++) {
    combs = comb(combs);
  }

  var result = 0; // each switch cases

  for (var _index2 = 0; _index2 < combs.length; _index2++) {
    var switches = combs[_index2];
    var match = 0; // each lamp        

    for (var m = 0; m < M; m++) {
      var sum = 0; // each connected switch

      for (var s = 1; s <= k[m][0]; s++) {
        sum += switches[k[m][s] - 1];
      } //console.log("sum, p[m]", sum, p[m]);


      if (sum % 2 != p[m]) {
        break;
      }

      match++;
    } //console.log(match);


    if (match == M) {
      result++;
    }
  }

  console.log(result);
}

function comb(combs) {
  var result = [];

  for (var index = 0; index < combs.length; index++) {
    var element = combs[index];
    result.push(element.concat(0));
    result.push(element.concat(1));
  }

  return result;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    var result;
    const N = parseInt(input[0].split(/\s/)[0]);
    const M = parseInt(input.shift().split(/\s/)[1]);

    const KS = input.slice(0, M).map(value => value.split(/\s/).map(v => parseInt(v)));
    const P = input.slice(M)[0].split(/\s/);
    
    var count = 0;
    generateMap(N).forEach(SW => check(SW, KS, P) == true ? count++ : 0);
    // check([1,1], KS, P);
    console.log(count);
    
}

function generateMap(N) {
    var arr = [];
    for (var index = 0; index < Math.pow(2, N); index++) {
        var value = index;
        var insert = [];
        for (var i = 0; i < N; i++) {
            insert.push(value % 2);
            value = Math.floor(value/2);
        }
        arr.push(insert);
    }
    return arr;
}

function check(sw, KS, P){
    // console.log(sw,KS,P);
    for (var index = 0; index < KS.length; index++) {
        var ks = KS[index];
        var check = 0;
        for (var i = 1; i < ks.length; i++) {
            var s = ks[i]-1;
            // console.log("sw[s]", sw[s]);
            if(sw[s] == 1) check++;
        }
        
        
        if(P[index] == "1") check++;
        // console.log(index, check);
        
        if(check%2 > 0) return false;
    };
    
    
    return true;
}

// 1行入力の場合
// Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

// 改行で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n/));

// 改行・空白で分割
// Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));
//  [go]
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n, m := scanInt(sc), scanInt(sc)
	tb := make([][]int, m)
	for i := 0; i < m; i++ {
		tb[i] = make([]int, n)
		l := scanInt(sc)
		for j := 0; j < l; j++ {
			tb[i][scanInt(sc)-1] = 1
		}
	}
	ps := make([]int, m)
	for i := 0; i < m; i++ {
		ps[i] = scanInt(sc)
	}
	num := 0
	for i := 0; i < 1<<uint(n); i++ {
		if accept(n, m, tb, ps, i) {
			num++
		}
	}
	return num
}

func accept(n, m int, tb [][]int, ps []int, idx int) bool {
	for i := 0; i < m; i++ {
		sum := 0
		for j := 0; j < n; j++ {
			if idx&(1<<uint(j)) == 0 {
				continue
			}
			sum += tb[i][j]
		}
		if ps[i] != sum%2 {
			return false
		}
	}
	return true
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

def bit_search(bit_num)
  for x in [*0...2**bit_num]
    # true, falseの配列がyieldされる
    yield x.to_s(2).rjust(bit_num, '0').split('').map { |s| s == '1' }
  end
end

N, M = get_ints
K = []
S = Array.new(M) { [] }
M.times do |i|
  line = get_ints_minus_one
  K[i] = line[0]
  S[i] = line[1..]
end
P = get_ints

ans = 0
bit_search(N) do |n_arr|
  count = 0
  S.each.with_index do |s_arr, p_index|
    on_count = s_arr.each.count { |s| n_arr[s] }
    count += 1 if on_count % 2 == P[p_index]
  end
  ans += 1 if count == M
end

puts ans
//  [ruby]
n, m = gets.chomp.split.map(&:to_i)
k_list_list = (1..m).map do
  gets.chomp.split.map(&:to_i)
end

p_list = gets.chomp.split.map(&:to_i)


def main(n, m, k_list_list, p_list)

  ans = 0;
  (0..2**n - 1).each do |n_ten|
    n_two = n_ten.to_s(2).rjust(n, '0')
    all_switch_statuses = n_two.chars.map(&:to_i)

    light_statuses = (0..m-1).map do |light_index|
      switch_indexes = k_list_list[light_index][1..]
      is_on = switch_indexes.map{ |index| 
        all_switch_statuses[index - 1] 
      }.sum % 2 === p_list[light_index]
    end

    unless light_statuses.include?(false)
      ans += 1
    end
  end
  ans
end

puts main(n, m, k_list_list, p_list)


# require 'minitest/autorun'

# class FooTest < Minitest::Test
#   def test_case1
#     assert_equal(1, main(2, 2, [[2, 1, 2], [1, 2]], [0, 1]))
#   end
# end
//  [ruby]
n, m = gets.split.map(&:to_i)
ks_m = m.times.map{|_| gets.split.map(&:to_i)}
p_m = gets.split.map(&:to_i)

ans = 0
[0, 1].repeated_permutation(n).to_a.each do |c|
  lighted = 0
  ks_m.each.with_index do |ks, idx|
    on = 0
    (1..ks[0]).each do |i|
      on += 1 if c[ks[i]-1] == 1
    end
    if on % 2 == p_m[idx]
      lighted += 1
    end
  end
  if lighted == m
    ans += 1
  end
end
p ans
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    let (n, m): (usize, usize) = parse_line().unwrap();
    let mut s_vec: Vec<Vec<usize>> = Vec::new(); 
    for _ in 0..m {
        let v: Vec<usize> = parse_line().unwrap();
        s_vec.push(v[1..].to_vec());
    }

    let p_vec: Vec<usize> = parse_line().unwrap();
    
    let mut ans = 0;

    for bit in 0..1<<n {
        let mut vec: Vec<usize> = Vec::new();
        for i in 0..n {
            if bit & (1<<i) != 0 {
                vec.push(i+1);
            }
        }

        // if vec.len() == 0 {
        //     continue;
        // }

        let mut flag = true;
        for i in 0..m {
            let set: HashSet<usize> = vec.clone().into_iter().collect();
            let s_set: HashSet<usize> = s_vec[i].clone().into_iter().collect();
            let intersect: Vec<&usize> = s_set.intersection(&set).collect::<Vec<&usize>>();
            if intersect.len() % 2 != p_vec[i] {
                flag = false;
                break;
            }
        }
        if flag {
            ans += 1;
        }
    }

    println!("{}", ans);
}
//  [rust]
// -*- coding:utf-8-unix -*-

use proconio::input;
use std::collections::HashSet;

fn main() {
    input! {
        n: usize,
        m: usize,
    }
    let mut k = vec![];
    let mut s = vec![];
    for _ in 0..m {
        input! {
            a: usize,
            b: [u16; a],
        }
        k.push(a);
        s.push(b);
    }
    input! {
        p: [u16; m],
    }
    // println!("k: {:?}", k);
    // println!("s: {:?}", s);
    // println!("p: {:?}", p);

    let mut ans = 0;
    for bit_row in 0..2u32.pow(n as u32) {
        // println!("{:b}", bit_row);
        let mut selected = HashSet::new();
        for i in 0..n {
            if (bit_row & (1 << i)) > 0 {
                selected.insert(i as u16);
            }
        }
        // println!("on: {:?}", selected);

        // if selected.len() == 0 {
        //     if p.iter().all(|&a| a == 0) {
        //         ans += 1;
        //     }
        // }

        for i in 0..m {
            let mut swsum = 0;
            for j in 0..k[i] {
                // スイッチは 1 スタート
                if selected.contains(&(s[i][j] - 1)) {
                    swsum += 1;
                }
            }
            // println!("sw no. {}: {}", i, swsum);
            if swsum % 2 != p[i] {
                break;
            }

            if i == m - 1 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}
//  [swift]
import Foundation

// 標準入力からnとmを受け取る
let nm = readLine()!.split(separator:" ").map{Int($0)!}
let n = nm[0]
let m = nm[1]

// 標準入力からkとsを受け取る
// 要素がすべて0で初期化されたn*mの2次元配列Sを用意
var S = [[Int]](repeating:[Int](repeating:0, count:m), count:n)
// Sに入力値を入れていく
for i in 0..<m{
    let s = readLine()!.split(separator:" ").map{Int($0)!}
    // s[0]==k
    for j in 0...s[0]{
        // kは除く
        if j == 0 {
            continue
        }
        S[s[j]-1][i] = 1
    }
}

// 標準入力からpを受け取る (答えの配列)
let p = readLine()!.split(separator:" ").map{Int($0)!}

// 答えを入れる変数を用意
var ans = 0

// 要素数nの集合についてbit全探索を行う
// 0~n^2のループ
for bit in 0..<(1<<n){

    // 電球の状態を持つ配列 (点灯しているなら1,消えているなら0)
    var check = [Int](repeating:0, count:m)
    
    // 順に左にシフトさせ最下位bitのチェックを行う
    for i in 0..<n{
    
        // フラグが立っているかどうかの判定
        if bit & 1<<i > 0 {
        
            // フラグが立っていた時の処理 (フラグが立つ = スイッチを入れる)
            // 各電球に対して全探索
            for j in 0..<m{
            
                // S[i][j] == 1ならばスイッチと電球はつながっている
                // スイッチを入れると点灯と消灯が反転する
                if S[i][j] == 1 && check[j] == 1{
                    check[j] = 0
                }
                else if S[i][j] == 1 && check[j] == 0{
                    check[j] = 1
                }
            }
        }
    }
    
    // 一致しているならすべて点灯している
    if p == check{
        ans += 1
    }
}

// 答えの出力
print(ans)
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [n, m] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const [, ..._ks] = stdin.trim().split('\n')
let ks = _ks.map(e => e.split(' ').map(Number))
const p = ks.pop()

const ans = _ => {
  const bulbs = Array(m).fill(null)

  ks.map(([k, ..._s], i) => {
    const s = _s.map(e => e - 1)

    let switches = Array(n).fill(0)

    s.forEach(v => {
      switches[v] = 1
    })

    bulbs[i] = switches
  })

  let sum = 0
  for (let i = 0; i < 1 << n; i++) {
    let iStr = i.toString(2)
    let filler = ''
    for (let j = 0; j < n - iStr.length; j++) {
      filler += '0'
    }
    const iArr = (filler + iStr).split('').map(Number)

    const bulbSwitchOnCounts = bulbs.map(b=>{
      return b.filter((e,i)=>{
        return iArr[i] & e
      }).length
    })

    const onBulbs = bulbSwitchOnCounts.filter((e,i)=>{
      return e%2 === p[i]
    }).length

    sum += onBulbs === m ? 1 : 0
  }

  console.log(sum)
}

ans()
//  [typescript]
function Main(input) {
  const data = input.split("\n");
  const [n, m] = data[0].split(" ").map(n => Number(n));
  const ps = data[m+1].split(" ").map(n => Number(n));
  let result = 0;
    for (let i = 0; i < 2 ** n; i++) {
        let str = i.toString(2);
      	const cnt = n - str.length;
        for (let tmp = 0; tmp < cnt; tmp++) {
            str = "0" + str;
        }
    const switches = str.split("").map(s => Number(s));
    let isOk = true;
    for (let j = 1; j <= m; j++) {
    	const sList = data[j].split(" ");
      	let onNum = 0;
      	for (let k = 1; k <= sList[0]; k++) {
          if (switches[sList[k] - 1] === 1) onNum++;
        }
      	if (onNum%2 !== ps[j-1]) {
          isOk = false;
          break;
        }
      }
    if (isOk) result++;
  }
  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
N=int(input())
ans=180*(N-2)
print(ans)
//  [python]
print((int(input())-2)*180)
//  [python]
N = int(input())
ans=(N-2)*180


print(ans)
//  [python]
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
print((N-2)*180)
//  [python]
#!venv/bin/python
 
import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 

#N, K = [ int(x) for x in input().split() ]
#V = [ int(x) for x in input().split() ]

N = int(input())

print((N-2)*180)
//  [python]
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

n=int(input())
print(180 * (n - 2))
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        int n = Integer.parseInt(stdin.readLine());
        stdout.println((n - 2) * 180);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}
//  [java]
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	private static final long M = 1000000007;

	void solve() {
		int n = ni();
		out.println((n-2)*180);

	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int[][] na(int n, int m) {
		int[][] a = new int[n][];
		for (int i = 0; i < n; i++)
			a[i] = na(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main implements Runnable {
	
    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }
    
    public void run() {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        
        long ans = (n-2)*180;
        	
        System.out.println(ans);
    }

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}
//  [java]
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;

public class Main {
    private static final Scanner scanner = new Scanner(System.in);
    private static final Consumer<List<String>> consumer = solve();

    public static void main(String[] args) {
        consumer.accept(readInput());
    }

    private static List<String> readInput() {
        final List<String> lineList = new ArrayList<>();
        while (scanner.hasNextLine()) {
            lineList.add(scanner.nextLine());
        }
        return lineList;
    }

    private static Consumer<List<String>> solve() {
        return args -> {
            int N = Integer.valueOf(args.get(0));
            System.out.println((N - 2) * 180);
        };
    }

}
//  [java]
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = (n-2)*180;
		System.out.println(ans);
		sc.close();
	} 
}
//  [java]
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();

    System.out.println(180 * (N - 2));

  }
}
//  [cpp]
#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	printf("%d\n",(n-2)*180);
	return 0;
}
//  [cpp]
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
	int N;
	scanf("%d", &N);
	printf("%d", N * 180 - 360);
	return 0;
}
//  [cpp]
#include<cstdio>
int n;
int main(){
	scanf("%d",&n);
	printf("%d\n",(n-2)*180);
	return 0;
}
//  [cpp]
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int main(){
	int N;
  cin >> N;
	cout << 180*(N-2) << endl;
}
//  [cpp]
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
using namespace std;
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout<<endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
typedef pair<int, int> P;

signed main() {
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;
}
//  [c]
#include <stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  
  printf("%d\n",180*(N-2));
  return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d",&n);
    m=(n-2)*180;
    printf("%d",m);
    return 0;
}
//  [c]
#include <stdio.h>

int main()
{
    int n;

    scanf ("%d", &n);
    printf("%d", (n - 2) * 180);
}
//  [c]
#include <stdio.h>

int main(void) {
	int N;
	if (scanf("%d", &N) != 1) return 1;
	printf("%d\n", 180 * (N - 2));
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>


int main()
{
  int cnt;
  int N;

  cnt = scanf("%d", &N);

  printf("%d", (180*(N-2)));

  return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    // Your code here!
    int a;
    scanf("%d",&a);
    printf("%d\n",(a-2)*180);
    
    return 0;
}
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  myout((N - 2) * 180);
}
//  [javascript]
function Main(input) {
  input = input.trim()
  console.log((input-2)*180);
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
(function(input){
  input=input.trim()-0;
  console.log(180*(input-2));
})(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  return n*180-360;
}
//  [javascript]
'use strict';

function main(stdin) {
  const input = Number(stdin);
  
  console.log(180 * (input - 2));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";

// read lines from stdin
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8");

const N = parseInt(input, 10);

console.log((N - 2) * 180);
//  [go]
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	fmt.Fprintln(writer, 180*(n-2))
}