

from __future__ import print_function

import os
import stat
import sys


if __name__ == '__main__':

    for line in sys.stdin:
        path = line.rstrip('\n')
        if path == '':
            continue
        if not os.path.isfile(path):
            continue
        st = os.stat(path)
        mode = st.st_mode
        os.chmod(path, mode | stat.S_IRUSR | stat.S_IWUSR)



from __future__ import print_function

import os
import stat
import sys


if __name__ == '__main__':

    for line in sys.stdin:
        path = line.rstrip('\n')
        if path == '':
            continue
        if not os.path.isfile(path):
            continue
        st = os.stat(path)
        mode = int('644', 8)
        if st.st_mode & stat.S_IXUSR != 0:
            mode = int('755', 8)
        with open(path) as f:
            x = f.read(2)
            if x == '#!':
                mode = int('755', 8)
        os.chmod(path, mode)

Change permissions to either 644 or 755.
Change permissions to either 644 or 755.

  
  
  from __future__ import print_function
  
  import os
  import stat
  import sys
  
  
  if __name__ == '__main__':
  
      for line in sys.stdin:
          path = line.rstrip('\n')
          if path == '':
              continue
          if not os.path.isfile(path):
              continue
          st = os.stat(path)
-         mode = st.st_mode
-         os.chmod(path, mode | stat.S_IRUSR | stat.S_IWUSR)
+         mode = int('644', 8)
+         if st.st_mode & stat.S_IXUSR != 0:
+             mode = int('755', 8)
+         with open(path) as f:
+             x = f.read(2)
+             if x == '#!':
+                 mode = int('755', 8)
+         os.chmod(path, mode)
  
Change permissions to either 644 or 755.
## Code Before:


from __future__ import print_function

import os
import stat
import sys


if __name__ == '__main__':

    for line in sys.stdin:
        path = line.rstrip('\n')
        if path == '':
            continue
        if not os.path.isfile(path):
            continue
        st = os.stat(path)
        mode = st.st_mode
        os.chmod(path, mode | stat.S_IRUSR | stat.S_IWUSR)

## Instruction:
Change permissions to either 644 or 755.
## Code After:


from __future__ import print_function

import os
import stat
import sys


if __name__ == '__main__':

    for line in sys.stdin:
        path = line.rstrip('\n')
        if path == '':
            continue
        if not os.path.isfile(path):
            continue
        st = os.stat(path)
        mode = int('644', 8)
        if st.st_mode & stat.S_IXUSR != 0:
            mode = int('755', 8)
        with open(path) as f:
            x = f.read(2)
            if x == '#!':
                mode = int('755', 8)
        os.chmod(path, mode)
