#include <stdio.h>

int	access(const char *__file, int __level)
{
	FILE *file ;
	switch(__level) {
		case 0:
		case 4:
			file = fopen(__file,"rb") ;
			break ;
		case 2:
		case 6:
			file = fopen(__file,"r+") ;
			break ;
		default :
			return -1 ;
	}
	if (file)
		fclose(file) ;
	return file ? 0 : -1 ;
}
main()
{
	printf("%d\n",access("q",0)) ;
	printf("%d\n",access("q",2)) ;
	printf("%d\n",access("q",4)) ;
	printf("%d\n",access("q",6)) ;
	printf("%d\n",access("r",0)) ;
	printf("%d\n",access("r",2)) ;
	printf("%d\n",access("r",4)) ;
	printf("%d\n",access("r",6)) ;
}